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".
  • IPhone iOS 5 Development Essentials - Techotopia
    and Outlets Designing the User Interface Checking the Data File on Application Startup Implementing the Action Method Building and Running the Example Preparing an iOS 5 iPhone App to use iCloud Storage What is iCloud iCloud Data Storage Services Preparing an Application to Use iCloud Storage Creating an iOS 5 iCloud enabled App ID Creating and Installing an iCloud Enabled Provisioning Profile Creating an iCloud Entitlements File Manually Creating the Entitlements File Defining the Ubiquity Container URL Managing iPhone Files using the iOS 5 UIDocument Class An Overview of the UIDocument Class Subclassing the UIDocument Class Conflict Resolution and Document States The UIDocument Example Application Creating a UIDocument Subclass Declaring the Outlets and Actions Designing the User Interface Implementing the Application Data Structure Implementing the contentsForType Method Implementing the loadFromContents Method Loading the Document at App Launch Saving Content to the Document Testing the Application Using iCloud Storage in an iOS 5 iPhone Application iCloud Usage Guidelines Preparing the iCloudStore Application for iCloud Access Configuring the View Controller Declaring the UBUIQUITY CONTAINER URL Constant Implementing the viewDidLoad Method Implementing the metadataQueryDidFinishGathering Method Implementing the saveDocument Method Enabling iCloud Document and Data Storage on an iPhone Running the iCloud Application Reviewing and Deleting iCloud Based Documents Making a Local File Ubiquitous Synchronizing iPhone iOS 5 Key Value Data using iCloud An Overview of iCloud Key Value Data Storage Sharing Data Between Applications Data Storage Restrictions Conflict Resolution Receiving Notification of Key Value Changes An iCloud Key Value Data Storage Example Enabling the Application for iCloud Key Value Data Storage Implementing the View Controller Modifying the viewDidLoad Method Implementing the Notification Method Implementing the saveData Method Designing the User Interface iOS 5 iPhone Data Persistence using Archiving An Overview of Archiving The Archiving Example Application Implementing the Actions and Outlets Memory Management Designing the User Interface Checking for the Existence of the Archive File on Startup Archiving Object Data in the Action Method Testing the Application iOS 5 iPhone Database Implementation using SQLite What is SQLite Structured Query Language SQL Trying SQLite on MacOS X Preparing an iPhone Application Project for SQLite Integration Key SQLite Functions Declaring a SQLite Database Opening or Creating a Database Preparing and Executing a SQL Statement Creating a Database Table Extracting Data from a Database Table Closing a SQLite Database An Example SQLite based iOS 5 iPhone Application About the Example SQLite iPhone Application Creating and Preparing the SQLite Application Project Importing sqlite3 h and declaring the Database Reference Creating the Outlets and Actions Releasing Memory Creating the Database and Table Implementing the Code to Save Data to the SQLite Database Implementing Code to Extract Data from the SQLite Database Designing the User Interface Building and Running the Application Working with iOS 5 iPhone Databases using Core Data The Core Data Stack Managed Objects Managed Object Context Managed Object Model Persistent Store Coordinator Persistent Object Store Defining an Entity Description Obtaining the Managed Object Context Getting an Entity Description Creating a Managed Object Getting and Setting the

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


  • About iPad iOS 6 Development Essentials - Techotopia
    be written to cover the new features of iOS 6 and every code example updated to reflect the changes made to Objective C How you make use of this book will depend to a large extent on whether you are new to iOS development or have worked with iOS 5 and need to get up to speed on the features of iOS 6 Rest assured however that the book is intended to address both category of reader For New iOS Developers If you are entirely new to iOS development then the entire contents of the book will be relevant to you Beginning with the basics this book provides an outline of the steps necessary to set up an iOS development environment An introduction to the architecture of iOS 6 and programming in Objective C is provided followed by an in depth look at the design of iPad applications and user interfaces More advanced topics such as file handling database management in app purchases graphics drawing and animation are also covered as are touch screen handling gesture recognition multitasking iAds integration location management local notifications camera access and video and audio playback support New iOS 6 specific features are also covered including Auto Layout Twitter and Facebook integration event reminders App Store hosted in app purchase content collection views and much more The aim of this book therefore is to teach you the skills necessary to build your own apps for the iPad Assuming you are ready to download the iOS 6 SDK and Xcode have an Intel based Mac and some ideas for some apps to develop you are ready to get started For iOS 5 Developers If you have already read iPad iOS 5 Development Essentials or have experience with the iOS 5 SDK then you might prefer to go directly to the new chapters in this iOS 6 edition of the book As previously mentioned if you have already read iPad iOS 5 Development Essentials you will find no fewer than 23 new chapters in this latest edition Chapters included in this edition that were not contained in the previous edition are as follows The Basics of Modern Objective C iPad An Introduction to iPad Auto Layout in iOS 6 Working with iPad iOS 6 Auto Layout Constraints in Interface Builder An iPad iOS 6 Auto Layout Example Implementing iPad iOS 6 Auto Layout Constraints in Code Implementing iPad Cross Hierarchy Auto Layout Constraints in iOS 6 Understanding the iPad iOS 6 Auto Layout Visual Format Language An Overview of iPad iOS 6 Collection View and Flow Layout An iPad iOS 6 Storyboard based Collection View Tutorial Subclassing and Extending the iOS 6 Collection View Flow Layout iPad An Overview of iPad iOS 6 Application State Preservation and Restoration An iOS 6 iPad State Preservation and Restoration Tutorial Integrating Maps into iPad iOS 6 Applications using MKMapItem An Example iOS 6 iPad MKMapItem Application Using iOS 6 Event Kit to Create iPad Date and Location Based Reminders Integrating

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

  • Creating a Simple iPad iOS 6 App - Techotopia
    Objective C compiler which removes much of the responsibility from the developer for releasing objects when they are no longer needed This is an extremely useful new feature and as such the option should be selected before clicking the Next button to proceed On the final screen choose a location on the file system for the new project to be created and click on Create Once the new project has been created the main Xcode window will appear as illustrated in Figure 5 4 Figure 5 4 Before proceeding we should take some time to look at what Xcode has done for us Firstly it has created a group of files that we will need to create our application Some of these are Objective C source code files with a m extension where we will enter the code to make our application work others are header or interface files h that are included by the source files and are where we will also need to put our own declarations and definitions In addition the xib file is the save file used by the Interface Builder tool to hold the user interface design we will create Older versions of Interface Builder saved designs in files with a nib extension so these files even today are called NIB files Also present will be one or more files with a plist file extension These are Property List files which contain key value pair information For example the HelloWorld info plist file contains resource settings relating to items such as the language icon file executable name and app identifier The list of files is displayed in the Project Navigator located in the left hand panel of the main Xcode project window A toolbar at the top of this panel contains build and run status breakpoints scheme selections and a range of settings to configure the panels displayed by Xcode By default the center panel of the window shows a summary of the settings for the application This includes the identifier specified during the project creation process and the target device Options are also provided to configure the orientations of the device that are to be supported by the application together with options to upload an icon the small image the user selects on the device screen to launch the application and splash screen image displayed to the user while the application loads for the application In addition to the Summary screen tabs are provided to view and modify additional settings consisting of Info Build Settings Build Phases and Build Rules As we progress through subsequent chapters of this book we will explore some of these other configuration options in greater detail To return to the Summary panel at any future point in time make sure the Project Navigator is selected in the left hand panel and select the top item the application name in the navigator list When a source file is selected from the list in the navigator panel the contents of that file will appear in the center panel where it may then be edited To open the file in a separate editing window simply double click on the file in the list Creating the iOS App User Interface Simply by the very nature of the environment in which they run iPad apps are typically visually oriented As such a key component of just about any app involves a user interface through which the user will interact with the application and in turn receive feedback Whilst it is possible to develop user interfaces by writing code to create and position items on the screen this is a complex and error prone process In recognition of this Apple provides a tool called Interface Builder which allows a user interface to be visually constructed by dragging and dropping components onto a canvas and setting properties to configure the appearance and behavior of those components Interface Builder was originally developed some time ago for creating Mac OS X applications but has now been updated to allow for the design of iOS app user interfaces As mentioned in the preceding section Xcode pre created a number of files for our project one of which has a xib filename extension This is an Interface Builder save file remember that they are called NIB files not XIB files The file we are interested in for our HelloWorld project is called HelloWorldViewController xib To load this file into Interface Builder simply select the file name in the list in the left hand panel Interface Builder will subsequently appear in the center panel as shown in Figure 5 5 Figure 5 5 In the center panel a visual representation of the user interface of the application is displayed Initially this consists solely of the UIView object This UIView object was added to our design by Xcode when we selected the Single View Application option during the project creation phase We will construct the user interface for our HelloWorld app by dragging and dropping user interface objects onto this UIView object Designing a user interface consists primarily of dragging and dropping visual components onto the canvas and setting a range of properties and settings In order to access objects and property settings it is necessary to display the Xcode right hand panel This is achieved by selecting the right hand button in the View section of the Xcode toolbar Figure 5 6 The right hand panel once displayed will appear as illustrated in Figure 5 7 Figure 5 7 Along the top edge of the panel is a row of buttons which change the settings displayed in the upper half of the panel By default the File Inspector is displayed Options are also provided to display quick help the Identity Inspector Attributes Inspector Size Inspector and Connections Inspector Before proceeding take some time to review each of these selections to gain some familiarity with the configuration options each provides Throughout the remainder of this book extensive use of these inspectors will

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

  • IPad iOS 6 Architecture and SDK Frameworks - Techotopia
    and voice communication between multiple devices and users allowing those running the same app to interact When this feature was first introduced it was anticipated by Apple that it would primarily be used in multi player games hence the choice of name but the possible applications for this feature clearly extend far beyond games development iAd Framework iAd framework The purpose of the iAd Framework is to allow developers to include banner advertising within their applications All advertisements are served by Apple s own ad service Event Kit UI Framework EventKit framework The Event Kit UI framework was introduced in iOS 4 and is provided to allow the calendar and reminder events to be accessed and edited from within an application Accounts Framework Accounts framework iOS 5 introduced the concept of system accounts These essentially allow the account information for other services to be stored on the iOS device and accessed from within application code Currently system accounts are limited to Twitter accounts though other services such as Facebook will likely appear in future iOS releases The purpose of the Accounts Framework is to provide an API allowing applications to access and manage these system accounts Social Framework Social framework The Social Framework allows Twitter Facebook and Sina Weibo integration to be added to applications The framework operates in conjunction the Accounts Framework to gain access to the user s social network account information The iOS Media Layer The role of the Media layer is to provide iOS with audio video animation and graphics capabilities As with the other layers comprising the iOS stack the Media layer comprises a number of frameworks which may be utilized when developing iPhone apps In this section we will look at each one in turn Core Video Framework CoreVideo framework The Core Video Framework provides buffering support for the Core Media framework Whilst this may be utilized by application developers it is typically not necessary to use this framework Core Text Framework CoreText framework The iOS Core Text framework is a C based API designed to ease the handling of advanced text layout and font rendering requirements Image I O Framework ImageIO framework The Image I O framework the purpose of which is to facilitate the importing and exporting of image data and image metadata was introduced in iOS 4 The framework supports a wide range of image formats including PNG JPEG TIFF and GIF Assets Library Framework AssetsLibrary framework The Assets Library provides a mechanism for locating and retrieving video and photo files located on the iPhone device In addition to accessing existing images and videos this framework also allows new photos and videos to be saved to the standard device photo album Core Graphics Framework CoreGraphics framework The iOS Core Graphics Framework otherwise known as the Quartz 2D API provides a lightweight two dimensional rendering engine Features of this framework include PDF document creation and presentation vector based drawing transparent layers path based drawing anti aliased rendering color manipulation and management image rendering and gradients Those familiar with the Quartz 2D API running on MacOS X will be pleased to learn that the implementation of this API is the same on iOS Core Image Framework CoreImage framework A new framework introduced with iOS 5 providing a set of video and image filtering and manipulation capabilities for application developers Quartz Core Framework QuartzCore framework The purpose of the Quartz Core framework is to provide animation capabilities on the iPhone It provides the foundation for the majority of the visual effects and animation used by the UIKit framework and provides an Objective C based programming interface for creation of specialized animation within iPhone apps OpenGL ES framework OpenGLES framework For many years the industry standard for high performance 2D and 3D graphics drawing has been OpenGL Originally developed by the now defunct Silicon Graphics Inc SGI during the 1990s in the form of GL the open version of this technology OpenGL is now under the care of a non profit consortium comprising a number of major companies including Apple Inc Intel Motorola and ARM Holdings OpenGL for Embedded Systems ES is a lightweight version of the full OpenGL specification designed specifically for smaller devices such as the iPhone iOS 3 or later supports both OpenGL ES 1 1 and 2 0 on certain iPhone models such as the iPhone 3GS and iPhone 4 Earlier versions of iOS and older device models support only OpenGL ES version 1 1 GLKit Framework GLKit framework The GLKit framework is an Objective C based API designed to ease the task of creating OpenGL ES based applications NewsstandKit Framework NewsstandKit framework The Newsstand application is a new feature of iOS 5 and is intended as a central location for users to gain access to newspapers and magazines The NewsstandKit framework allows for the development of applications that utilize this new service iOS Audio Support iOS is capable of supporting audio in AAC Apple Lossless ALAC A law IMA ADPCM Linear PCM µ law DVI Intel IMA ADPCM Microsoft GSM 6 10 and AES3 2003 formats through the support provided by the following frameworks AV Foundation framework AVFoundation framework An Objective C based framework designed to allow the playback recording and management of audio content Core Audio Frameworks CoreAudio framework AudioToolbox framework and AudioUnit framework The frameworks that comprise Core Audio for iOS define supported audio types playback and recording of audio files and streams and also provide access to the device s built in audio processing units Open Audio Library OpenAL OpenAL is a cross platform technology used to provide high quality 3D audio effects also referred to as positional audio Positional audio may be used in a variety of applications though is typically used to provide sound effects in games Media Player Framework MediaPlayer framework The iOS Media Player framework is able to play video in mov mp4 m4v and 3gp formats at a variety of compression standards resolutions and frame rates Core Midi Framework CoreMIDI framework Introduced

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

  • Testing iOS 6 Apps on the iPad – Developer Certificates and Provisioning Profiles - Techotopia
    device To add a device to the portal from within Organizer simply connect the device open the Organizer window in Xcode using the Organizer toolbar button select the attached device from the left hand panel and click on the Add to Portal button The Organizer will prompt for the developer portal login and password before connecting and enabling the device for testing Manually adding a device on the other hand requires the use of the iPad s UDID This may be obtained either via Xcode or iTunes Begin by connecting the device to your computer using the docking connector Once Xcode has launched the Organizer window will appear displaying summary information about the device or may be opened by selecting the Organizer button in the Xcode toolbar The UDID is listed next to the Identifier label as illustrated in Figure 7 8 Figure 7 8 Alternatively launch iTunes select the device in the left hand pane and review the Summary information page One of the fields on this page will be labeled as Serial Number Click with the mouse on this number and it will change to display the UDID Having identified the UDIDs of any devices you plan to use for app testing select the Devices link located in the left hand panel of the iOS Provisioning Portal and click on Add Devices in the resulting page On the Add Devices page enter a descriptive name for the device and the 40 character UDID Figure 7 9 In order to add more than one device at a time simply click on the button to create more input fields Once you have finished adding devices click on the Submit button The newly added devices will now appear on the main Devices page of the portal Creating an App ID The next step in the process is to create an App ID for each app that you create This ID allows your app to be uniquely identified within the context of the Apple iOS ecosystem To create an App ID select the App IDs link in the provisioning portal and click on the New App ID button to display the Create App ID screen as illustrated in Figure 7 10 Figure 7 10 Enter a suitably descriptive name into the Description field and then make a Bundle Seed ID selection If you have not created any previous Seed IDs then leave the default Generate New selection unchanged If you have created a previous App ID and would like to use this for your new app click on the menu and select the desired ID from the drop down list Finally enter the Bundle Identifier This is typically set to the reversed domain name of your company followed by the name of the app For example if you are developing an app called MyApp and the URL for your company is www mycompany com then your Bundle identifier would be entered as com mycompany MyApp If you would like to create an

    Original URL path: http://www.techotopia.com/index.php/Testing_iOS_6_Apps_on_the_iPad_%E2%80%93_Developer_Certificates_and_Provisioning_Profiles (2016-02-13)
    Open archived version from archive

  • Creating an Interactive iOS 6 iPad App - Techotopia
    Selecting the UnitConverterViewController h file in the Xcode project navigator panel will display the contents of the file in the editing pane import UIKit UIKit h interface UnitConverterViewController UIViewController end As we can see from the above code a new class called UnitConverterViewController has been created that is a subclass of the UIViewController class belonging to the UIKit framework The next step is to extend the subclass to include the two outlets and our action method We will begin by adding outlets for our text field and label objects by declaring appropriate properties in conjunction with the IBOutlet keyword import UIKit UIKit h interface UnitConverterViewController UIViewController property strong nonatomic IBOutlet UILabel resultLabel property strong nonatomic IBOutlet UITextField tempText end Next we need to declare the action that will be called when the user touches the Convert button in our user interface This is declared using the IBAction keyword import UIKit UIKit h interface UnitConverterViewController UIViewController property strong nonatomic IBOutlet UILabel resultLabel property strong nonatomic IBOutlet UITextField tempText IBAction convertTemp id sender end We have now declared that our View Controller class contains a method called convertTemp Having made that declaration we need to implement the method in the implementation source file To do so select the UnitConverterViewController m file so that the contents appear in the editing pane import UnitConverterViewController h interface UnitConverterViewController end implementation UnitConverterViewController void viewDidLoad super viewDidLoad Do any additional setup after loading the view typically from a nib void didReceiveMemoryWarning super didReceiveMemoryWarning Dispose of any resources that can be recreated end At the bottom of the file and before the end marker add the new convertTemp method as follows import UnitConverterViewController h implementation UnitConverterViewController void convertTemp id sender double farenheit tempText text doubleValue double celsius farenheit 32 1 8 NSString resultString NSString alloc initWithFormat Celsius f celsius resultLabel text resultString end Before we proceed it is probably a good idea to pause and explain what is happening in the above code Those already familiar with Objective C however may skip the next few paragraphs In this file we are implementing the convertTemp method originally declared in the h file This method takes as a single argument a reference to the sender The sender is the object that triggered the call to the method in this case our Button object Whilst we won t be using this object in the current example this can be used to create a general purpose method in which the behavior of the method changes depending on how i e via which object it was called We could for example create two buttons labeled Convert to Fahrenheit and Convert to Celsius respectively each of which calls the same convertTemp method The method would then access the sender object to identify which button triggered the event and perform the corresponding type of unit conversion Next the code declares a variable of type double in order to handle the fact that the user may have entered a floating point value We then use dot

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

  • Writing iOS 6 Code to Hide the iPad Keyboard - Techotopia
    dragging with the mouse from the File s Owner icon to the text field object in the View From the resulting menu select the textField outlet Hiding the Keyboard when the User Touches the Return Key The next step is to wire up our application so that the keyboard is dismissed when the user touches the keyboard Return key To do so we need to write a method that will resign the first responder on the text field in other words hide the keyboard when the return key is pressed Begin by editing the HideKeyboardViewController h interface file to declare the method which we will name textFieldReturn import UIKit UIKit h interface HideKeyboardViewController UIViewController property strong nonatomic IBOutlet UITextField textField IBAction textFieldReturn id sender end Having declared the method we now need to implement it in the HideKeyboardViewController m implementation file import HideKeyboardViewController h implementation HideKeyboardViewController interface HideKeyboardViewController end IBAction textFieldReturn id sender sender resignFirstResponder end In the above method we are making a call to the resignFirstResponder method of the object that triggered the event The first responder is the object with which the user is currently interacting in this instance the virtual keyboard displayed on the iPad screen Having written the code for our method we now need to wire up our user interface so that it gets called at the appropriate time We will perform this task in Interface Builder so select HideKeyboardViewController xib once more Select the text field in the view and display the Connections Inspector View Utilities Connections Inspector in the right hand panel Click on the circle to the right of the Did End on Exit event drag the line to the File s Owner icon and select textFieldReturn from the list of available methods Click on the Run button in the Xcode toolbar When the application appears in the iOS Simulator select the text field so that the keyboard appears and then touch the Return key The keyboard should subsequently disappear from view Hiding the Keyboard when the User Taps the Background The second mechanism for hiding the keyboard involves wiring up an event to be called when the user touches the background view of the screen We will begin the process by writing the action method to perform this task From within Xcode select the HideKeyboardViewController h file and add a declaration for our new backgroundTouched action method import UIKit UIKit h interface HideKeyboardViewController UIViewController property nonatomic strong IBOutlet UITextField textField IBAction textFieldReturn id sender IBAction backgroundTouched id sender end Select the HideKeyboardViewController m file and implement the action by calling the resignFirst Responder method of our textField object import HideKeyboardViewController h interface HideKeyboardViewController end implementation HideKeyboardViewController IBAction textFieldReturn id sender sender resignFirstResponder IBAction backgroundTouched id sender textField resignFirstResponder end Having written the code for our action method we now need to make sure it gets called when the user touches the background view This involves some work in Interface Builder so select the HideKeyboardViewController xib file In order to make

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

  • An Introduction to iPad Auto Layout in iOS 6 - Techotopia
    as it is less than or equal to 800 myLabel 800 The label is now permitted to grow in width up to the specified limit allowing longer content to be displayed without clipping Auto layout constraints are by nature interdependent and as such situations can arise where a constraint on one view competes with a constraint on another view to which it is connected In such situations it may be necessary to make one constraint stronger and the other weaker in order to provide the system with a way of arriving at a layout solution This is achieved by assigning priorities to constraints Priorities are assigned on a scale of 0 to 1000 with 1000 representing a required constraint and lower numbers equating to optional constraints When faced with a decision between the needs of a required constraint and an optional constraint the system will meet the needs of the required constraint exactly while attempting to get as close as possible to those of the optional constraint In the case of two optional constraints the needs of the constraint with the higher priority will be addressed before those of the lower Alignment Rects When working with constraints it is important to be aware that constraints operate on the content of a view not the frame in which a view is displayed This content is referred to as the alignment rect of the view Alignment constraints such as those that cause the center of one view to align with that of another will do so based on the alignment rects of the views disregarding any padding that may have been configured for the frame of the view Intrinsic Content Size Some views also have what is known as an intrinsic content size This is the preferred size that a view itself believes it needs to be to display its content to the user A Button view for example will have an intrinsic content size in terms of height and width that is based primarily on the text or image it is required to display and internal rules on the margins that should be placed around that content When a view has an intrinsic content size auto layout will automatically assign two constraints for each dimension for which the view has indicated an intrinsic content size preference i e height and or width One constraint is intended to prevent the size of the view becoming larger than the size of the content otherwise known as the content hugging constraint The other constraint is intended to prevent the view from being sized smaller than the content referred to as the compression resistance constraint Content Hugging and Compression Resistance Priorities The resize behavior of a view with an intrinsic content size can be controlled by specifying compression resistance and content hugging priorities A view with a high compression resistance priority and a low content hugging priority will be allowed to grow but will resist shrinking in the corresponding dimension Similarly a high compression resistance

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



  •