¡@

Home 

2014/10/15 ¤U¤È 10:08:33

iphone Programming Glossary: example

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

feel like it provides a better interface because then the user can scroll and change textboxes for example. I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and..

Add UIPickerView & a Button in Action sheet - How?

http://stackoverflow.com/questions/1262574/add-uipickerview-a-button-in-action-sheet-how

self self presentViewController navigationController animated YES completion nil I create a simple example and posted it on github . Also see Showing actionsheet causes CGContext invalid context errors . share..

Cropping a UIImage

http://stackoverflow.com/questions/158914/cropping-a-uiimage

desired results CGImageCreateWithImageInRect CGImageRef CGRect will help you out. Here's a short example using it CGImageRef imageRef CGImageCreateWithImageInRect largeImage CGImage cropRect or use the UIImage..

Is there a documented way to set the iPhone orientation?

http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation

Are there any documented ways to force the orientation Update I thought I would provide an example as I am not looking for shouldAutorotateToInterfaceOrientation as I have already implemented that. I..

Send and receive messages through NSNotificationCenter in Objective-C? [closed]

http://stackoverflow.com/questions/2191594/send-and-receive-messages-through-nsnotificationcenter-in-objective-c

and receive messages through NSNotificationCenter in Objective C closed I need a simple example program to send and receive a message through NSNotificationCenter in Objective C iphone objective..

How do I associate file types with an iPhone application?

http://stackoverflow.com/questions/2774343/how-do-i-associate-file-types-with-an-iphone-application

uses a document controller can hand off processing of these documents to your own application. For example my application Molecules for which the source code is available handles the .pdb and .pdb.gz file types.. because this capability has been ported across from the Mac. One of the UTIs used in the above example was system defined but the other was an application specific UTI. The application specific UTI will.. pdb string key public.mime type key string chemical x pdb string dict dict array This particular example exports the com.sunsetlakesoftware.molecules.pdb UTI with the .pdb file extension corresponding to the..

Check iPhone iOS Version

http://stackoverflow.com/questions/3339722/check-iphone-ios-version

usually a more reliable method of checking whether a particular feature or class is available. For example you can check if UIPopoverController is available on the current device using NSClassFromString if NSClassFromString..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

I'm still no clearer on how to create this kind of transform on an iPhone. Any help pointers or example code snippets would be really appreciated iphone ios cocoa touch core animation share improve this.. which rebuilds the layer transform from scratch for each rotation. A full example of this with code can be found here where I've implemented touch based rotation and scaling on a couple.. here where I've implemented touch based rotation and scaling on a couple of CALayers based on an example by Bill Dudney. The newest version of the program at the very bottom of the page implements this kind..

Prefixing property names with an underscore in Objective C [duplicate]

http://stackoverflow.com/questions/3521254/prefixing-property-names-with-an-underscore-in-objective-c

NSString myStringProperty In the implementation @synthesize myStringProperty But in almost every example it is done like In the header @interface Whatever NSString _myStringProperty @property nonatomic copy..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

PDF viewers are pretty heavy on memory too. Even monitor the memory usage of apple's zoomable PDF example. In my current project I'm developing a PDF viewer and am rendering a UIImage of a page in a separate..

How do I size a UITextView to its content?

http://stackoverflow.com/questions/50467/how-do-i-size-a-uitextview-to-its-content

hold all of the lines in the text view so that I can adjust the parent view accordingly As another example look at the Notes field for events in the Calendar application note how the cell and the UITextView..

How do I create delegates in Objective-C?

http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c

use a formal protocol you must declare your delegate to implement that protocol see below. For example suppose you have an NSWindow. If you'd like to implement its delegate's windowDidMove method you could.. retain loops since the delegate of an object often holds a strong reference to that object. For example a view controller is often the delegate of a view it contains. To define your own delegates you'll have.. protocols 1 An Informal Protocol This can be done as NSWindow does in a category on NSObject. For example continuing the example above this is paraphrased from NSWindow.h @interface NSObject NSWindowNotifications..

How to develop or migrate apps for iPhone 5 screen resolution?

http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution

need to consider status bar height if it's present as there seems to be no specific API for that. Example CGRect screenBounds UIScreen mainScreen bounds if screenBounds.size.height 568 code for 4 inch screen..

Free Weather API [closed]

http://stackoverflow.com/questions/1305127/free-weather-api

feed weather.ashx q 90210 format json num_of_days 5 key c0901b281c095607121605 Example app code . NOAA REST Interface Example http www.weather.gov forecasts xml sample_products browser_interface.. 90210 format json num_of_days 5 key c0901b281c095607121605 Example app code . NOAA REST Interface Example http www.weather.gov forecasts xml sample_products browser_interface ndfdXMLclient.php zipCodeList 90210.. begin 2004 01 01T00 00 00 end 2013 04 21T00 00 00 maxt maxt mint mint Yahoo Weather Forecast RSS Example http weather.yahooapis.com forecastrss p 90210 Google Weather API Currently deactivated and the only..

The simplest way to resize an UIImage?

http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage

newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return newImage Example usage #import MYUtil.h UIImage myIcon MYUtil imageWithImage myUIImageInstance scaledToSize CGSizeMake..

Bold & Non-Bold Text In A Single UILabel?

http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel

but I have no idea how to use that. Any ideas Apple achieves this in several of their apps Examples Screenshot Thanks Dom iphone objective c ipad nsattributedstring share improve this question Update.. CATextLayer with an NSAttributedString much lighter and simpler than 2 UILabels. iOS 3.2 and above Example. Don't forget to add QuartzCore framework needed for CALayers and CoreText needed for the attributed..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

display Documentation Quartz PDFObjects Used for meta info annotations thumbs Abobe PDF Spec Example projects Apple ZoomingPDF zooming UIScrollView CATiledLayer vfr reader zooming paging UIScrollView CATiledView..

parsing HTML on the iPhone [closed]

http://stackoverflow.com/questions/405749/parsing-html-on-the-iphone

Take a walk on w3school XPath Tutorial to feel comfortable with the XPath language. Code Example #import TFHpple.h NSData data NSData alloc initWithContentsOfFile @ example.html Create parser xpathParser..

iOS SDK - Programmatically generate a PDF file

http://stackoverflow.com/questions/4362734/ios-sdk-programmatically-generate-a-pdf-file

various elements. I used tags to find the appropriate elements but you could do this other ways. Example UILabel label UILabel templateView viewWithTag TAG_FIRST_NAME if label nil label.text firstName nil..

iPhone get SSID without private library

http://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library

@ __func__ ifnam info if info info count break info release ifs release return info autorelease Example output 2011 03 04 15 32 00.669 ShowSSID 4857 307 ShowSSIDAppDelegate fetchSSIDInfo Supported interfaces..

How to hide uitabbarcontroller

http://stackoverflow.com/questions/5272290/how-to-hide-uitabbarcontroller

it but without using hidesBottomBarWhenPushed because I want to hide it not when i pushed it. For Example i want to hide it when i press Hide button in my application. I read many articles in google but I cant..

Subclass UIButton to add a property

http://stackoverflow.com/questions/5500327/subclass-uibutton-to-add-a-property

NSObject property return NSObject objc_getAssociatedObject self UIB_PROPERTY_KEY @end Example usage #import UIButton Property.h ... UIButton button1 UIButton buttonWithType UIButtonTypeRoundedRect..

What's the best way to communicate between view controllers?

http://stackoverflow.com/questions/569940/whats-the-best-way-to-communicate-between-view-controllers

an example of using the dependency injection pattern with a controller below in case it's helpful. Example of Using Dependency Injection with a View Controller Let's say you're building a screen in which several..

Example or explanation of Core Data Migration with multiple passes?

http://stackoverflow.com/questions/5995231/example-or-explanation-of-core-data-migration-with-multiple-passes

or explanation of Core Data Migration with multiple passes My iPhone app needs to migrate its core..

Understanding reference counting with Cocoa and Objective-C

http://stackoverflow.com/questions/6578/understanding-reference-counting-with-cocoa-and-objective-c

to call release on the object when I'm done with it. If I don't there will be a memory leak. Example of object creation NSString s NSString alloc init Ref count is 1 s retain Ref count is 2 silly to..

performSelector may cause a leak because its selector is unknown

http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown

a warning since the pointer types don't match . Finally you call the function pointer. Complex Example When the selector takes arguments or returns a value you'll have to change things a bit SEL selector..

Open Source Cocoa/Cocoa-Touch POP3/SMTP library?

http://stackoverflow.com/questions/740939/open-source-cocoa-cocoa-touch-pop3-smtp-library

which has also been modified to compile for 10.4 as well as 10.5 so should work on the iPhone Example code using Pantomime from the above blog post CWMessage message CWMessage alloc init CWInternetAddress..

Syntax help - Variable as object name [duplicate]

http://stackoverflow.com/questions/7940809/syntax-help-variable-as-object-name

Variable Variables&rdquo How would I create and reference an object using a variable as it's name Example for int i 1 i 7 i CGRect myRectNum i myImageView.bounds myRectNum 5 .height etc .. iphone objective..

Animate change of view controllers without using navigation controller stack, subviews or modal controllers?

http://stackoverflow.com/questions/8146253/animate-change-of-view-controllers-without-using-navigation-controller-stack-su

options transition completion ^ BOOL finished self.window.rootViewController viewController Example use in a view controller IBAction flipToNextView AnotherViewController anotherVC AnotherVC alloc init.....

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

when the keyboard comes up. Even though it's not needed I feel like it provides a better interface because then the user can scroll and change textboxes for example. I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using void textFieldDidBeginEditing UITextField..

Add UIPickerView & a Button in Action sheet - How?

http://stackoverflow.com/questions/1262574/add-uipickerview-a-button-in-action-sheet-how

Cropping a UIImage

http://stackoverflow.com/questions/158914/cropping-a-uiimage

do this but there is a function that you can use to get the desired results CGImageCreateWithImageInRect CGImageRef CGRect will help you out. Here's a short example using it CGImageRef imageRef CGImageCreateWithImageInRect largeImage CGImage cropRect or use the UIImage wherever you like UIImageView setImage UIImage imageWithCGImage..

Is there a documented way to set the iPhone orientation?

http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation

currentDevice setOrientation UIInterfaceOrientationPortrait Are there any documented ways to force the orientation Update I thought I would provide an example as I am not looking for shouldAutorotateToInterfaceOrientation as I have already implemented that. I want my app to support landscape and portrait in View 1 but..

Send and receive messages through NSNotificationCenter in Objective-C? [closed]

http://stackoverflow.com/questions/2191594/send-and-receive-messages-through-nsnotificationcenter-in-objective-c

and receive messages through NSNotificationCenter in Objective C closed I need a simple example program to send and receive a message through NSNotificationCenter in Objective C iphone objective c ios nsnotificationcenter share improve this question @implementation..

How do I associate file types with an iPhone application?

http://stackoverflow.com/questions/2774343/how-do-i-associate-file-types-with-an-iphone-application

handle particular document types and any application that uses a document controller can hand off processing of these documents to your own application. For example my application Molecules for which the source code is available handles the .pdb and .pdb.gz file types if received via email or in another supported application... Overview . Those guides reside in the Mac developer center because this capability has been ported across from the Mac. One of the UTIs used in the above example was system defined but the other was an application specific UTI. The application specific UTI will need to be exported so that other applications on the system.. key dict key public.filename extension key string pdb string key public.mime type key string chemical x pdb string dict dict array This particular example exports the com.sunsetlakesoftware.molecules.pdb UTI with the .pdb file extension corresponding to the MIME type chemical x pdb . With this in place your application..

Check iPhone iOS Version

http://stackoverflow.com/questions/3339722/check-iphone-ios-version

as an indication of device or OS capabilities. There is usually a more reliable method of checking whether a particular feature or class is available. For example you can check if UIPopoverController is available on the current device using NSClassFromString if NSClassFromString @ UIPopoverController Do something Some classes..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

all the pragmatic programmer Core Animation podcasts but I'm still no clearer on how to create this kind of transform on an iPhone. Any help pointers or example code snippets would be really appreciated iphone ios cocoa touch core animation share improve this question As Ben said you'll need to work with the UIView's.. 45.0f M_PI 180.0f 0.0f 1.0f 0.0f layer.transform rotationAndPerspectiveTransform which rebuilds the layer transform from scratch for each rotation. A full example of this with code can be found here where I've implemented touch based rotation and scaling on a couple of CALayers based on an example by Bill Dudney. The newest.. each rotation. A full example of this with code can be found here where I've implemented touch based rotation and scaling on a couple of CALayers based on an example by Bill Dudney. The newest version of the program at the very bottom of the page implements this kind of perspective operation. The code should be reasonably simple..

Prefixing property names with an underscore in Objective C [duplicate]

http://stackoverflow.com/questions/3521254/prefixing-property-names-with-an-underscore-in-objective-c

Whatever NSString myStringProperty @property nonatomic copy NSString myStringProperty In the implementation @synthesize myStringProperty But in almost every example it is done like In the header @interface Whatever NSString _myStringProperty @property nonatomic copy NSString myStringProperty In the implementation @synthesize..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

be prepared ahead of time rendered off screen . Generally PDF viewers are pretty heavy on memory too. Even monitor the memory usage of apple's zoomable PDF example. In my current project I'm developing a PDF viewer and am rendering a UIImage of a page in a separate thread issues here too and presenting it while the scale is..

How do I size a UITextView to its content?

http://stackoverflow.com/questions/50467/how-do-i-size-a-uitextview-to-its-content

there a good way in Cocoa Touch to get the rect that will hold all of the lines in the text view so that I can adjust the parent view accordingly As another example look at the Notes field for events in the Calendar application note how the cell and the UITextView it contains expands to hold all lines of text in the notes string...

How do I create delegates in Objective-C?

http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c

methods you're interested in. Though with delegates that use a formal protocol you must declare your delegate to implement that protocol see below. For example suppose you have an NSWindow. If you'd like to implement its delegate's windowDidMove method you could create a class like this @implementation MyClass void windowDidMove.. is typically declared weak in ARC or assign pre ARC to avoid retain loops since the delegate of an object often holds a strong reference to that object. For example a view controller is often the delegate of a view it contains. To define your own delegates you'll have to declare their methods somewhere. There are two basic.. are two basic approaches discussed in the Apple Docs on protocols 1 An Informal Protocol This can be done as NSWindow does in a category on NSObject. For example continuing the example above this is paraphrased from NSWindow.h @interface NSObject NSWindowNotifications void windowDidMove NSNotification notification ... other..

How to develop or migrate apps for iPhone 5 screen resolution?

http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution

UIScreen mainScreen bounds or applicationFrame but then you need to consider status bar height if it's present as there seems to be no specific API for that. Example CGRect screenBounds UIScreen mainScreen bounds if screenBounds.size.height 568 code for 4 inch screen else code for 3.5 inch screen Also note The auto rotation..

Free Weather API [closed]

http://stackoverflow.com/questions/1305127/free-weather-api

weather apis World Weather Online API example http free.worldweatheronline.com feed weather.ashx q 90210 format json num_of_days 5 key c0901b281c095607121605 Example app code . NOAA REST Interface Example http www.weather.gov forecasts xml sample_products browser_interface ndfdXMLclient.php zipCodeList 90210 product time series.. example http free.worldweatheronline.com feed weather.ashx q 90210 format json num_of_days 5 key c0901b281c095607121605 Example app code . NOAA REST Interface Example http www.weather.gov forecasts xml sample_products browser_interface ndfdXMLclient.php zipCodeList 90210 product time series begin 2004 01 01T00 00 00 end 2013.. ndfdXMLclient.php zipCodeList 90210 product time series begin 2004 01 01T00 00 00 end 2013 04 21T00 00 00 maxt maxt mint mint Yahoo Weather Forecast RSS Example http weather.yahooapis.com forecastrss p 90210 Google Weather API Currently deactivated and the only hack to get it to work is to add a referrer in the link but..

The simplest way to resize an UIImage?

http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage

Bold & Non-Bold Text In A Single UILabel?

http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel

I've also read this may be possible using NSAttributedString but I have no idea how to use that. Any ideas Apple achieves this in several of their apps Examples Screenshot Thanks Dom iphone objective c ipad nsattributedstring share improve this question Update for iOS6 In iOS6 now UILabel UIButton UITextView UITextField.. I hope it is enough Old Answer for iOS5 and below Use a CATextLayer with an NSAttributedString much lighter and simpler than 2 UILabels. iOS 3.2 and above Example. Don't forget to add QuartzCore framework needed for CALayers and CoreText needed for the attributed string. #import QuartzCore QuartzCore.h #import CoreText CoreText.h..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

and Off Screen Rendering render the next page for fast smooth display Documentation Quartz PDFObjects Used for meta info annotations thumbs Abobe PDF Spec Example projects Apple ZoomingPDF zooming UIScrollView CATiledLayer vfr reader zooming paging UIScrollView CATiledView brow leaves paging with nice transitions skim everything..

parsing HTML on the iPhone [closed]

http://stackoverflow.com/questions/405749/parsing-html-on-the-iphone

TFpple.m TFppleElement.h TFppleElement.m XPathQuery.h XPathQuery.m Take a walk on w3school XPath Tutorial to feel comfortable with the XPath language. Code Example #import TFHpple.h NSData data NSData alloc initWithContentsOfFile @ example.html Create parser xpathParser TFHpple alloc initWithHTMLData data Get all the cells..

iOS SDK - Programmatically generate a PDF file

http://stackoverflow.com/questions/4362734/ios-sdk-programmatically-generate-a-pdf-file

UIView class return view return nil I then fill in various elements. I used tags to find the appropriate elements but you could do this other ways. Example UILabel label UILabel templateView viewWithTag TAG_FIRST_NAME if label nil label.text firstName nil firstName @ None Then I call a function to render the view to..

iPhone get SSID without private library

http://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library

id CNCopyCurrentNetworkInfo CFStringRef ifnam NSLog @ s @ @ __func__ ifnam info if info info count break info release ifs release return info autorelease Example output 2011 03 04 15 32 00.669 ShowSSID 4857 307 ShowSSIDAppDelegate fetchSSIDInfo Supported interfaces en0 2011 03 04 15 32 00.693 ShowSSID 4857 307 ShowSSIDAppDelegate..

How to hide uitabbarcontroller

http://stackoverflow.com/questions/5272290/how-to-hide-uitabbarcontroller

with UITabBarController. In my application i want to hide it but without using hidesBottomBarWhenPushed because I want to hide it not when i pushed it. For Example i want to hide it when i press Hide button in my application. I read many articles in google but I cant find out how I can do this. iphone ios uitabbarcontroller..

Subclass UIButton to add a property

http://stackoverflow.com/questions/5500327/subclass-uibutton-to-add-a-property

self UIB_PROPERTY_KEY property OBJC_ASSOCIATION_RETAIN_NONATOMIC NSObject property return NSObject objc_getAssociatedObject self UIB_PROPERTY_KEY @end Example usage #import UIButton Property.h ... UIButton button1 UIButton buttonWithType UIButtonTypeRoundedRect button1.property @ HELLO NSLog @ Property @ button1.property..

What's the best way to communicate between view controllers?

http://stackoverflow.com/questions/569940/whats-the-best-way-to-communicate-between-view-controllers

injection. That's the gist of my response. I'll include an example of using the dependency injection pattern with a controller below in case it's helpful. Example of Using Dependency Injection with a View Controller Let's say you're building a screen in which several books are listed. The user can pick books he she wants..

Example or explanation of Core Data Migration with multiple passes?

http://stackoverflow.com/questions/5995231/example-or-explanation-of-core-data-migration-with-multiple-passes

or explanation of Core Data Migration with multiple passes My iPhone app needs to migrate its core data store and some of the databases are quite large. Apple's..

Understanding reference counting with Cocoa and Objective-C

http://stackoverflow.com/questions/6578/understanding-reference-counting-with-cocoa-and-objective-c

an init method. In either of these cases it is my responsibility to call release on the object when I'm done with it. If I don't there will be a memory leak. Example of object creation NSString s NSString alloc init Ref count is 1 s retain Ref count is 2 silly to do this after init s release Ref count is back to 1 s release..

performSelector may cause a leak because its selector is unknown

http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown

compiler that you know what you're doing and not to generate a warning since the pointer types don't match . Finally you call the function pointer. Complex Example When the selector takes arguments or returns a value you'll have to change things a bit SEL selector NSSelectorFromString @ processRegion ofView IMP imp _controller..

Open Source Cocoa/Cocoa-Touch POP3/SMTP library?

http://stackoverflow.com/questions/740939/open-source-cocoa-cocoa-touch-pop3-smtp-library

site for this seems to be down but there is a mirror on github which has also been modified to compile for 10.4 as well as 10.5 so should work on the iPhone Example code using Pantomime from the above blog post CWMessage message CWMessage alloc init CWInternetAddress address address CWInternetAddress alloc initWithString @..

Syntax help - Variable as object name [duplicate]

http://stackoverflow.com/questions/7940809/syntax-help-variable-as-object-name

based on an int count Objective C Equivalent of PHP's &ldquo Variable Variables&rdquo How would I create and reference an object using a variable as it's name Example for int i 1 i 7 i CGRect myRectNum i myImageView.bounds myRectNum 5 .height etc .. iphone objective c ios xcode share improve this question There isn't anything..

Animate change of view controllers without using navigation controller stack, subviews or modal controllers?

http://stackoverflow.com/questions/8146253/animate-change-of-view-controllers-without-using-navigation-controller-stack-su

toView viewController.view duration 0.65f options transition completion ^ BOOL finished self.window.rootViewController viewController Example use in a view controller IBAction flipToNextView AnotherViewController anotherVC AnotherVC alloc init... MyAppDelegate appDelegate MyAppDelegate UIApplication sharedApplication..

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

it's not needed I feel like it provides a better interface because then the user can scroll and change textboxes for example. I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using..

Add UIPickerView & a Button in Action sheet - How?

http://stackoverflow.com/questions/1262574/add-uipickerview-a-button-in-action-sheet-how

self self presentViewController navigationController animated YES completion nil I create a simple example and posted it on github . Also see Showing actionsheet causes CGContext invalid context errors . share improve this answer..

Cropping a UIImage

http://stackoverflow.com/questions/158914/cropping-a-uiimage

can use to get the desired results CGImageCreateWithImageInRect CGImageRef CGRect will help you out. Here's a short example using it CGImageRef imageRef CGImageCreateWithImageInRect largeImage CGImage cropRect or use the UIImage wherever you like..

Is there a documented way to set the iPhone orientation?

http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation

Are there any documented ways to force the orientation Update I thought I would provide an example as I am not looking for shouldAutorotateToInterfaceOrientation as I have already implemented that. I want my app to support..

Send and receive messages through NSNotificationCenter in Objective-C? [closed]

http://stackoverflow.com/questions/2191594/send-and-receive-messages-through-nsnotificationcenter-in-objective-c

and receive messages through NSNotificationCenter in Objective C closed I need a simple example program to send and receive a message through NSNotificationCenter in Objective C iphone objective c ios nsnotificationcenter..

How do I associate file types with an iPhone application?

http://stackoverflow.com/questions/2774343/how-do-i-associate-file-types-with-an-iphone-application

application that uses a document controller can hand off processing of these documents to your own application. For example my application Molecules for which the source code is available handles the .pdb and .pdb.gz file types if received via.. Mac developer center because this capability has been ported across from the Mac. One of the UTIs used in the above example was system defined but the other was an application specific UTI. The application specific UTI will need to be exported.. extension key string pdb string key public.mime type key string chemical x pdb string dict dict array This particular example exports the com.sunsetlakesoftware.molecules.pdb UTI with the .pdb file extension corresponding to the MIME type chemical..

Check iPhone iOS Version

http://stackoverflow.com/questions/3339722/check-iphone-ios-version

There is usually a more reliable method of checking whether a particular feature or class is available. For example you can check if UIPopoverController is available on the current device using NSClassFromString if NSClassFromString @ UIPopoverController..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

Animation podcasts but I'm still no clearer on how to create this kind of transform on an iPhone. Any help pointers or example code snippets would be really appreciated iphone ios cocoa touch core animation share improve this question As Ben.. rotationAndPerspectiveTransform which rebuilds the layer transform from scratch for each rotation. A full example of this with code can be found here where I've implemented touch based rotation and scaling on a couple of CALayers based.. code can be found here where I've implemented touch based rotation and scaling on a couple of CALayers based on an example by Bill Dudney. The newest version of the program at the very bottom of the page implements this kind of perspective operation...

Prefixing property names with an underscore in Objective C [duplicate]

http://stackoverflow.com/questions/3521254/prefixing-property-names-with-an-underscore-in-objective-c

nonatomic copy NSString myStringProperty In the implementation @synthesize myStringProperty But in almost every example it is done like In the header @interface Whatever NSString _myStringProperty @property nonatomic copy NSString myStringProperty..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

screen . Generally PDF viewers are pretty heavy on memory too. Even monitor the memory usage of apple's zoomable PDF example. In my current project I'm developing a PDF viewer and am rendering a UIImage of a page in a separate thread issues here..

How do I size a UITextView to its content?

http://stackoverflow.com/questions/50467/how-do-i-size-a-uitextview-to-its-content

the rect that will hold all of the lines in the text view so that I can adjust the parent view accordingly As another example look at the Notes field for events in the Calendar application note how the cell and the UITextView it contains expands..

How do I create delegates in Objective-C?

http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c

with delegates that use a formal protocol you must declare your delegate to implement that protocol see below. For example suppose you have an NSWindow. If you'd like to implement its delegate's windowDidMove method you could create a class like.. pre ARC to avoid retain loops since the delegate of an object often holds a strong reference to that object. For example a view controller is often the delegate of a view it contains. To define your own delegates you'll have to declare their.. in the Apple Docs on protocols 1 An Informal Protocol This can be done as NSWindow does in a category on NSObject. For example continuing the example above this is paraphrased from NSWindow.h @interface NSObject NSWindowNotifications void windowDidMove..

How to develop or migrate apps for iPhone 5 screen resolution?

http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution

but then you need to consider status bar height if it's present as there seems to be no specific API for that. Example CGRect screenBounds UIScreen mainScreen bounds if screenBounds.size.height 568 code for 4 inch screen else code for 3.5..

Free Weather API [closed]

http://stackoverflow.com/questions/1305127/free-weather-api

http free.worldweatheronline.com feed weather.ashx q 90210 format json num_of_days 5 key c0901b281c095607121605 Example app code . NOAA REST Interface Example http www.weather.gov forecasts xml sample_products browser_interface ndfdXMLclient.php.. feed weather.ashx q 90210 format json num_of_days 5 key c0901b281c095607121605 Example app code . NOAA REST Interface Example http www.weather.gov forecasts xml sample_products browser_interface ndfdXMLclient.php zipCodeList 90210 product time series.. product time series begin 2004 01 01T00 00 00 end 2013 04 21T00 00 00 maxt maxt mint mint Yahoo Weather Forecast RSS Example http weather.yahooapis.com forecastrss p 90210 Google Weather API Currently deactivated and the only hack to get it to work..

The simplest way to resize an UIImage?

http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage

newSize.height UIImage newImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return newImage Example usage #import MYUtil.h UIImage myIcon MYUtil imageWithImage myUIImageInstance scaledToSize CGSizeMake 20 20 share improve..

Bold & Non-Bold Text In A Single UILabel?

http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel

using NSAttributedString but I have no idea how to use that. Any ideas Apple achieves this in several of their apps Examples Screenshot Thanks Dom iphone objective c ipad nsattributedstring share improve this question Update for iOS6 In iOS6.. and below Use a CATextLayer with an NSAttributedString much lighter and simpler than 2 UILabels. iOS 3.2 and above Example. Don't forget to add QuartzCore framework needed for CALayers and CoreText needed for the attributed string. #import QuartzCore..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

next page for fast smooth display Documentation Quartz PDFObjects Used for meta info annotations thumbs Abobe PDF Spec Example projects Apple ZoomingPDF zooming UIScrollView CATiledLayer vfr reader zooming paging UIScrollView CATiledView brow leaves..

parsing HTML on the iPhone [closed]

http://stackoverflow.com/questions/405749/parsing-html-on-the-iphone

XPathQuery.h XPathQuery.m Take a walk on w3school XPath Tutorial to feel comfortable with the XPath language. Code Example #import TFHpple.h NSData data NSData alloc initWithContentsOfFile @ example.html Create parser xpathParser TFHpple alloc..

iOS SDK - Programmatically generate a PDF file

http://stackoverflow.com/questions/4362734/ios-sdk-programmatically-generate-a-pdf-file

nil I then fill in various elements. I used tags to find the appropriate elements but you could do this other ways. Example UILabel label UILabel templateView viewWithTag TAG_FIRST_NAME if label nil label.text firstName nil firstName @ None Then..

iPhone get SSID without private library

http://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library

ifnam NSLog @ s @ @ __func__ ifnam info if info info count break info release ifs release return info autorelease Example output 2011 03 04 15 32 00.669 ShowSSID 4857 307 ShowSSIDAppDelegate fetchSSIDInfo Supported interfaces en0 2011 03 04 15..

How to hide uitabbarcontroller

http://stackoverflow.com/questions/5272290/how-to-hide-uitabbarcontroller

i want to hide it but without using hidesBottomBarWhenPushed because I want to hide it not when i pushed it. For Example i want to hide it when i press Hide button in my application. I read many articles in google but I cant find out how I can..

Subclass UIButton to add a property

http://stackoverflow.com/questions/5500327/subclass-uibutton-to-add-a-property

NSObject property return NSObject objc_getAssociatedObject self UIB_PROPERTY_KEY @end Example usage #import UIButton Property.h ... UIButton button1 UIButton buttonWithType UIButtonTypeRoundedRect button1.property..

What's the best way to communicate between view controllers?

http://stackoverflow.com/questions/569940/whats-the-best-way-to-communicate-between-view-controllers

I'll include an example of using the dependency injection pattern with a controller below in case it's helpful. Example of Using Dependency Injection with a View Controller Let's say you're building a screen in which several books are listed...

Example or explanation of Core Data Migration with multiple passes?

http://stackoverflow.com/questions/5995231/example-or-explanation-of-core-data-migration-with-multiple-passes

or explanation of Core Data Migration with multiple passes My iPhone app needs to migrate its core data store and some..

Understanding reference counting with Cocoa and Objective-C

http://stackoverflow.com/questions/6578/understanding-reference-counting-with-cocoa-and-objective-c

it is my responsibility to call release on the object when I'm done with it. If I don't there will be a memory leak. Example of object creation NSString s NSString alloc init Ref count is 1 s retain Ref count is 2 silly to do this after init..

performSelector may cause a leak because its selector is unknown

http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown

and not to generate a warning since the pointer types don't match . Finally you call the function pointer. Complex Example When the selector takes arguments or returns a value you'll have to change things a bit SEL selector NSSelectorFromString..

Open Source Cocoa/Cocoa-Touch POP3/SMTP library?

http://stackoverflow.com/questions/740939/open-source-cocoa-cocoa-touch-pop3-smtp-library

is a mirror on github which has also been modified to compile for 10.4 as well as 10.5 so should work on the iPhone Example code using Pantomime from the above blog post CWMessage message CWMessage alloc init CWInternetAddress address address CWInternetAddress..

Syntax help - Variable as object name [duplicate]

http://stackoverflow.com/questions/7940809/syntax-help-variable-as-object-name

of PHP's &ldquo Variable Variables&rdquo How would I create and reference an object using a variable as it's name Example for int i 1 i 7 i CGRect myRectNum i myImageView.bounds myRectNum 5 .height etc .. iphone objective c ios xcode share..

Animate change of view controllers without using navigation controller stack, subviews or modal controllers?

http://stackoverflow.com/questions/8146253/animate-change-of-view-controllers-without-using-navigation-controller-stack-su

duration 0.65f options transition completion ^ BOOL finished self.window.rootViewController viewController Example use in a view controller IBAction flipToNextView AnotherViewController anotherVC AnotherVC alloc init... MyAppDelegate appDelegate..

QR Code Scanning in ios application

http://stackoverflow.com/questions/16166646/qr-code-scanning-in-ios-application

0 ZBarImageScanner scanner reader.scanner TODO optional additional reader configuration here EXAMPLE disable rarely used I2 5 to improve performance scanner setSymbology ZBAR_I25 config ZBAR_CFG_ENABLE to 0 present and release.. symbol in results hiddenData NSString stringWithString symbol.data NSLog @ the symbols is the following @ symbol.data EXAMPLE just grab the first barcode break EXAMPLE do something useful with the barcode data resultText.text symbol.data resultTextView.text.. symbol.data NSLog @ the symbols is the following @ symbol.data EXAMPLE just grab the first barcode break EXAMPLE do something useful with the barcode data resultText.text symbol.data resultTextView.text symbol.data NSLog @ BARCODE @..

How to resize UIBarButtonItem in code

http://stackoverflow.com/questions/6950325/how-to-resize-uibarbuttonitem-in-code

Implementing a QR reader in a cocos2d engine

http://stackoverflow.com/questions/6977404/implementing-a-qr-reader-in-a-cocos2d-engine

reader.readerDelegate self ZBarImageScanner scanner reader.scanner TODO optional additional reader configuration here EXAMPLE disable rarely used I2 5 to improve performance scanner setSymbology ZBAR_I25 config ZBAR_CFG_ENABLE to 0 present and..

Animate change of view controllers without using navigation controller stack, subviews or modal controllers?

http://stackoverflow.com/questions/8146253/animate-change-of-view-controllers-without-using-navigation-controller-stack-su

are limited to iOS 5 and are almost ideal but cannot be used in all projects. Can someone present a SOLID CODE EXAMPLE on a way to change view controllers without the above limitations and allows for animated transitions between them A close..