archive-com.com » COM » T » TECHOTOPIA.COM

Total: 1018

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • An iPhone Graphics Drawing Tutorial using Quartz 2D - Techotopia
    CGContextAddLineToPoint context 300 400 CGContextStrokePath context CGColorSpaceRelease colorspace CGColorRelease color When compiled and run the application should display as illustrated in the following figure Note that in the above example we manually created the colorspace and color reference As described in Drawing iPhone 2D Graphics with Quartz colors can also be created using the UIColor class For example the same result as outlined above can be achieved with fewer lines of code as follows void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetLineWidth context 2 0 CGContextSetStrokeColorWithColor context UIColor blueColor CGColor CGContextMoveToPoint context 0 0 CGContextAddLineToPoint context 300 400 CGContextStrokePath context Drawing Paths As you may have noticed in the above example we draw a single line by essentially defining the path between two points Defining a path that comprises multiple points allows us to draw using a sequence of straight lines all connected to each other using repeated calls the CGContextAddLineToPoint function Non straight lines may also be added to a shape using calls to for example the CGContextAddArc function The following code draws a diamond shape void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetLineWidth context 2 0 CGContextSetStrokeColorWithColor context UIColor blueColor CGColor CGContextMoveToPoint context 100 100 CGContextAddLineToPoint context 150 150 CGContextAddLineToPoint context 100 200 CGContextAddLineToPoint context 50 150 CGContextAddLineToPoint context 100 100 CGContextStrokePath context When executed the above code should produce output that appears as follows Drawing a Rectangle Rectangles are drawn in much the same way as any other path is drawn with the exception that the path is defined by specifying the x and y co ordinates of the top left hand corner of the rectangle together with the rectangle s height and width These dimensions are stored in a CGRect structure and passed through as an argument to the CGContextAddRect function void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetLineWidth context 2 0 CGContextSetStrokeColorWithColor context UIColor blueColor CGColor CGRect rectangle CGRectMake 60 170 200 80 CGContextAddRect context rectangle CGContextStrokePath context The above code will result in the following display when compiled and executed Drawing an Ellipse or Circle Circles and ellipses are drawn by defining the rectangular area into which the shape must fit and then calling the CGContextAddEllipseInRect function void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetLineWidth context 2 0 CGContextSetStrokeColorWithColor context UIColor blueColor CGColor CGRect rectangle CGRectMake 60 170 200 80 CGContextAddEllipseInRect context rectangle CGContextStrokePath context When compiled the above code will produce the following graphics In order to draw a circle simply define a rectangle with equal length sides a square in other words Filling a Path with a Color A path may be filled with a color using a variety of Quartz 2D API functions Rectangular and elliptical paths may be filled using the CGContextFillRect and CGContextFillEllipse functions respectively Similarly a path may be filled using the CGContextFillPath function Prior to executing a fill operation the fill color must be specified using the CGContextSetFillColorWithColor function The following example defines a path and then fills it with the color red void drawRect CGRect rect

    Original URL path: http://www.techotopia.com/index.php/An_iPhone_Graphics_Drawing_Tutorial_using_Quartz_2D (2016-02-13)
    Open archived version from archive


  • IPhone App Development Essentials - Techotopia
    Running the Sample Application Adding Actions and Outlets Connecting the Actions and Outlets to the User Interface Building and Running the Finished Application Understanding iPhone Views Windows and the View Hierarchy An Overview of Views The UIWindow Class The View Hierarchy View Types The Window Container Views Controls Display Views Text and Web Views Navigation Views and Tab Bars Alert Views and Action Sheets Writing Code to Hide the iPhone Keyboard Creating the Example App Hiding the Keyboard when the User Touches the Return Key Hiding the Keyboard when the User Taps the Background iPhone Rotation View Resizing and Layout Handling Setting up the Example Enabling Rotation Testing Rotation Behavior Configuring View Autosizing Coding Layout and Size Changes Creating an iPhone Multiview Application using the Tab Bar An Overview of the Tab Bar Understanding View Controllers in a Multiview Application Setting up the Tab Bar Example Application Creating the Content Views and View Controllers Configuring the App Delegate Creating the UITabBarController Associating Content Views with Tabs Connecting the App Delegate Outlet to the Tab Bar Controller Designing the Content Views Testing the Multiview Application Creating a Simple iPhone Table View Application An Overview of the Table View The Table View Delegate and dataSource Table View Styles Table View Cell Styles Setting up the Project Adding the Table View Component Making the Delegate and dataSource Connections Implementing the dataSource Building and Running the Application Adding Table View Images and Changing Cell Styles Creating a Navigation based iPhone Application using TableViews Understanding the Navigation Controller An Overview of the Example Setting up the Project Reviewing the Project Files Setting up the Data in the Root View Controller Writing Code to Display the Data in the Table View Creating the Second View Controller Connecting the Second View Controller to the Root View Controller Creating the NIB File for the Second Table View Implementing the Functionality of the Second View Controller Popping the View Controller off the Navigation Controller Stack Adding the Navigation Code Working with Directories on iPhone OS The Application Documents Directory The Objective C NSFileManager NSFileHandle and NSData Classes Understanding Pathnames in Objective C Creating an NSFileManager Instance Object Identifying the Current Working Directory Identifying the Documents Directory Identifying the Temporary Directory Changing Directory Creating a New Directory Deleting a Directory Listing the Contents of a Directory Getting the Attributes of a File or Directory Working with Files on the iPhone Creating an NSFileManager Instance Checking if a File Exists Comparing the Contents of Two Files Checking if a File is Readable Writable Executable Deletable Moving Renaming a File Copying a File Removing a File Creating a Symbolic Link Reading and Writing Files with NSFileManager Working with Files using the NSFileHandle Class Creating an NSFileHandle Object NSFileHandle File Offsets and Seeking Reading Data from a File Writing Data to a File Truncating a File iPhone OS Directory Handling and File I O A Worked Example The Example Application Setting up the Application project Defining the Actions and Outlets Designing the User

    Original URL path: http://www.techotopia.com/index.php?title=IPhone_App_Development_Essentials&oldid=22337 (2016-02-13)
    Open archived version from archive

  • Pages that link to "IPhone App Development Essentials" - Techotopia
    iPhone links About iPhone App Development Essentials links The iPhone OS Architecture and Frameworks links The iPhone OS Cocoa Touch Layer links The iPhone OS Media Layer links The iPhone OS Core Services Layer links The iPhone OS Core OS Layer links Installing Xcode and the iPhone SDK links The Basics of Objective C Programming links The Basics of Object Oriented Programming in Objective C links Testing Apps on the iPhone Developer Certificates and Provisioning Profiles links Creating a Simple iPhone App links An Overview of the iPhone Application Development Architecture links Creating an Interactive iPhone App links Understanding iPhone Views Windows and the View Hierarchy links Writing Code to Hide the iPhone Keyboard links NewMain links IPhone Rotation View Resizing and Layout Handling links Creating an iPhone Multiview Application using the Tab Bar links Creating a Navigation based iPhone Application using TableViews links Creating a Simple iPhone Table View Application links Working with Directories on iPhone OS links Working with Files on the iPhone links IPhone OS Directory Handling and File I O A Worked Example links IPhone Data Persistence using Archiving links IPhone Database Implementation using SQLite links An Example SQLite based iPhone Application links Working with iPhone

    Original URL path: http://www.techotopia.com/index.php/Special:WhatLinksHere/IPhone_App_Development_Essentials (2016-02-13)
    Open archived version from archive

  • IPhone App Development Essentials - Techotopia
    of Views The UIWindow Class The View Hierarchy View Types The Window Container Views Controls Display Views Text and Web Views Navigation Views and Tab Bars Alert Views and Action Sheets Writing Code to Hide the iPhone Keyboard Creating the Example App Hiding the Keyboard when the User Touches the Return Key Hiding the Keyboard when the User Taps the Background iPhone Rotation View Resizing and Layout Handling Setting up the Example Enabling Rotation Testing Rotation Behavior Configuring View Autosizing Coding Layout and Size Changes Creating an iPhone Multiview Application using the Tab Bar An Overview of the Tab Bar Understanding View Controllers in a Multiview Application Setting up the Tab Bar Example Application Creating the Content Views and View Controllers Configuring the App Delegate Creating the UITabBarController Associating Content Views with Tabs Connecting the App Delegate Outlet to the Tab Bar Controller Designing the Content Views Testing the Multiview Application Creating a Simple iPhone Table View Application An Overview of the Table View The Table View Delegate and dataSource Table View Styles Table View Cell Styles Setting up the Project Adding the Table View Component Making the Delegate and dataSource Connections Implementing the dataSource Building and Running the Application Adding Table View Images and Changing Cell Styles Creating a Navigation based iPhone Application using TableViews Understanding the Navigation Controller An Overview of the Example Setting up the Project Reviewing the Project Files Setting up the Data in the Root View Controller Writing Code to Display the Data in the Table View Creating the Second View Controller Connecting the Second View Controller to the Root View Controller Creating the NIB File for the Second Table View Implementing the Functionality of the Second View Controller Popping the View Controller off the Navigation Controller Stack Adding the Navigation Code Working with Directories on iPhone OS The Application Documents Directory The Objective C NSFileManager NSFileHandle and NSData Classes Understanding Pathnames in Objective C Creating an NSFileManager Instance Object Identifying the Current Working Directory Identifying the Documents Directory Identifying the Temporary Directory Changing Directory Creating a New Directory Deleting a Directory Listing the Contents of a Directory Getting the Attributes of a File or Directory Working with Files on the iPhone Creating an NSFileManager Instance Checking if a File Exists Comparing the Contents of Two Files Checking if a File is Readable Writable Executable Deletable Moving Renaming a File Copying a File Removing a File Creating a Symbolic Link Reading and Writing Files with NSFileManager Working with Files using the NSFileHandle Class Creating an NSFileHandle Object NSFileHandle File Offsets and Seeking Reading Data from a File Writing Data to a File Truncating a File iPhone OS Directory Handling and File I O A Worked Example The Example Application Setting up the Application project Defining the Actions and Outlets Designing the User Interface Checking the Data File on Application Startup Implementing the Action Method Building and Running the Example iPhone Data Persistence using Archiving An Overview of Archiving The Archiving Example Application Implementing the Actions

    Original URL path: http://www.techotopia.com/index.php?title=IPhone_App_Development_Essentials&printable=yes (2016-02-13)
    Open archived version from archive

  • Information for "IPhone App Development Essentials" - Techotopia
    Page ID 1333 Page content language English en Page content model wikitext Indexing by robots Allowed Number of redirects to this page 2 Counted as a content page Yes Page protection Edit Allow all users infinite Move Allow all users infinite Edit history Page creator Neil Talk contribs Date of page creation 19 45 26 February 2010 Latest editor Neil Talk contribs Date of latest edit 21 24 1 February

    Original URL path: http://www.techotopia.com/index.php?title=IPhone_App_Development_Essentials&action=info (2016-02-13)
    Open archived version from archive

  • An Overview of WatchKit Apps - Techotopia
    that provide the underlying functionality of both the WatchKit extension and WatchKit app WatchKit for example provides the classes that can be used to construct a WatchKit app user interface such as Button Label and Slider classes WatchKit is also responsible for handling the communication between the iPhone device on which the WatchKit extension is running and the corresponding WatchKit app installed on the Apple Watch eBookFrenzy com Purchase the fully updated watchOS 2 Swift 2 edition of this book in eBook 12 99 or Print 27 99 format watchOS 2 App Development Essentials Print and eBook ePub PDF Kindle editions contain 35 chapters Understanding iOS Extensions Extensions are a feature introduced as part of the iOS 8 SDK release and were originally intended solely to allow certain capabilities of an application to be made available for use within other applications running on the same device The developer of a photo editing application might for example have devised some unique image filtering capabilities and decide that those features would be particularly useful to users of the iOS Photos app To achieve this the developer would implement these features in a Photo Editing extension which would then appear as an option to users when editing an image within the Photos app Other extension types are also available for performing document storage creating custom keyboards and embedding information from an application into the iOS notification panel With the introduction of the Apple Watch and WatchKit however the concept of extensions has now been extended to make the functionality of an iOS app available in the form of a WatchKit app Extensions are separate executable binaries that run independently of the corresponding iOS application Although extensions take the form of an individual binary they must be supplied and installed as part of an iOS application bundle The application with which an extension is bundled is referred to as the containing app or parent app The containing app must provide useful functionality and must not be an empty application provided solely for the purpose of delivering an extension to the user Once an iOS application containing a WatchKit extension has been installed on an iPhone device it will be accessible from the Apple Watch device paired with that iPhone When the user launches a WatchKit app on a watch device the WatchKit framework will launch the corresponding WatchKit extension on the paired iPhone device establish communication between the two entities and then begin the app initialization process Basic WatchKit App Extension Structure Simply by the nature of its physical size an Apple Watch is always going to be resource constrained in terms of storage and processing power when compared to an iPhone As previously outlined the implementation of a WatchKit app is divided between the WatchKit app installed on the watch and the WatchKit extension bundled with the iOS app on the iPhone device This raises the questions of how the responsibilities of providing the functionality of the WatchKit app are divided between the

    Original URL path: http://www.techotopia.com/index.php/An_Overview_of_WatchKit_Apps (2016-02-13)
    Open archived version from archive

  • Building an Example WatchKit App - Techotopia
    Attributes Inspector in the utilities panel View Utilities Show Attributes Inspector Within the inspector panel use the drop down menu for the Image attribute to select the watchkit image option Figure 3 10 Finally select the Label object in the scene and use the Attribute Inspector panel to change the Alignment attribute so that the text is centered within the label Having set this attribute a review of the scene will show that the text is still positioned on the left of the layout The reason for this is that the text has been centered within the label but the Label object itself is still positioned on the left side of the display To correct this locate the Position section in the Attributes Inspector panel and change the Horizontal attribute from Left to Center Figure 3 11 shows the Attributes Inspector panel with these attributes set Figure 3 11 Running the WatchKit App All that remains is to run the WatchKit app and make sure that it appears as expected For the purposes of this example this will be performed using the simulator environment By default Xcode will run the iOS app on an iPhone simulator In order to test the WatchKit app the run target will need to be changed in the Xcode toolbar Select the current scheme in the toolbar and use the drop down menu Figure 3 12 to select the WatchKitSample WatchKit App iPhone 6 option Figure 3 12 With the WatchKit app selected click on the run button Once the simulator has loaded two windows should appear one representing the iPhone 6 device and the other the Apple Watch device After a short delay the WatchKit app should appear on the watch simulator display as illustrated in Figure 3 13 Figure 3 13 If the WatchKit simulator window fails to appear use the iOS Simulator Hardware External Displays menu option to select one of the Apple Watch options By default Xcode will launch the 42mm Apple Watch simulator To also test the layout on the 38mm Apple Watch model select the iOS Simulator Hardware External Displays Apple Watch 38 mm menu option and then stop and restart the WatchKit app from within Xcode Running the App on a Physical Apple Watch Device In order to test the app on a physical Apple Watch device connect the iPhone with which the Apple Watch is paired to the development system and select it as the target device within the Xcode toolbar panel Figure 3 14 Figure 3 14 eBookFrenzy com Purchase the fully updated watchOS 2 Swift 2 edition of this book in eBook 12 99 or Print 27 99 format watchOS 2 App Development Essentials Print and eBook ePub PDF Kindle editions contain 35 chapters With WatchKitSample WatchKit App still selected as the run target click on the run button and wait for the app icon to appear on the Apple Watch home screen Once the icon appears tap on it to launch the app Depending

    Original URL path: http://www.techotopia.com/index.php/Building_an_Example_WatchKit_App (2016-02-13)
    Open archived version from archive

  • An Overview of the WatchKit App Architecture - Techotopia
    is triggered In order for that event to achieve anything it needs to trigger a method call on the interface controller class Use of a technique known as target action provides a way to specify what happens when such events are triggered In other words this is how you connect the objects in the user interface you have designed in the Interface Builder tool to the back end Swift code you have implemented in the corresponding interface controller class Specifically this allows you to define which method of the interface controller gets called when a user interacts in a certain way with a user interface object The process of wiring up a user interface object to call a specific method on an interface controller is achieved using something called an Action Similarly the target method is referred to as an action method Action methods are declared within the interface controller class using the IBAction keyword for example IBAction func buttonPress println Button Pressed Perform tasks in response to a button press WatchKit Outlets The opposite of an Action is an Outlet As previously described an Action allows a method in an interface controller instance to be called in response to a user interaction with a user interface element An Outlet on the other hand allows an interface controller to make changes to the properties of a user interface element An interface controller might for example need to set the text on a Label object In order to do so an Outlet must first have been defined using the IBOutlet keyword In programming terms an IBOutlet is simply an instance variable that references the user interface object to which access is required The following line demonstrates an outlet declaration for a label IBOutlet weak var myLabel WKInterfaceLabel Once outlets and actions have been implemented and connected all of the communication required to make these connections work is handled transparently by WatchKit Figure 4 1 provides a visual representation of actions and outlets Figure 4 1 Outlets and actions can be created visually with just a few mouse clicks from within Xcode using the Interface Builder tool in conjunction with the Assistant Editor panel a topic which will be covered in detail in the chapter entitled An Example Interactive WatchKit App using Actions and Outlets eBookFrenzy com Purchase the fully updated watchOS 2 Swift 2 edition of this book in eBook 12 99 or Print 27 99 format watchOS 2 App Development Essentials Print and eBook ePub PDF Kindle editions contain 35 chapters The Lifecycle of a WatchKit App The lifecycle of a WatchKit app and the corresponding WatchKit extension is actually very simple When a WatchKit app is launched on the device a scene will be loaded from within the storyboard file When the scene has loaded the WatchKit framework will request that the extension corresponding to the app be launched on the iPhone device or woken up if it is currently suspended The extension is then instructed to create the

    Original URL path: http://www.techotopia.com/index.php/An_Overview_of_the_WatchKit_App_Architecture (2016-02-13)
    Open archived version from archive