The Cocoa Touch frameworks that drive iOS apps share many proven patterns found on the Mac, but were built with a special focus on touch-based interfaces and optimization.
496
votes
21answers
180k views
How to check for an active Internet Connection on iPhone SDK?
I would like to check to see if I have an Internet connection on the iPhone using the Cocoa Touch libraries.
I came up with a way to do this using an NSURL. The way I did it seems a bit unreliable ...
97
votes
8answers
23k views
How does an underscore in front of a variable in a cocoa objective-c class work?
I've seen in a few iPhone examples that attributes have used an underscore _ in front of the variable. Does anyone know what this means? or how it works?
an interface file I'm using looks like:
...
416
votes
16answers
176k views
How to sort an NSMutableArray with custom objects in it?
What I want to do seems pretty simple, but I can't find any answers on the web. I have an NSMutableArray of objects, let's say they are 'Person' objects. I want to sort the NSMutableArray by ...
397
votes
26answers
156k views
Can I embed a custom font in an iPhone application?
I would like to have an app include a custom font for rendering text, load it, and then use it with standard UIKit elements like UILabel. Is this possible?
I found these links:
...
95
votes
6answers
66k views
How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?
I have a UIImage (Cocoa Touch). From that, I'm happy to get a CGImage or anything else you'd like that's available. I'd like to write this function:
- (int)getRGBAFromImage:(UIImage *)image ...
175
votes
3answers
63k views
How do I associate file types with an iPhone application?
On the subject of associating your iPhone app with file types.
In this informative question I learned that apps could be associated with custom URL protocols.
That was almost one year ago and since ...
438
votes
14answers
112k views
@class vs. #import
It is to my understanding that one should use a forward-class declaration in the event ClassA needs to include a ClassB header, and ClassB needs to include a ClassA header to avoid any circular ...
229
votes
10answers
134k views
How to programmatically send SMS on the iPhone?
Does anybody know if it's possible, and how, to programmatically send a SMS from the iPhone, with the official SDK / Cocoa Touch?
196
votes
6answers
72k views
NSString property: copy or retain?
Let's say I have a class called SomeClass with a string property name:
@interface SomeClass : NSObject
{
NSString* name;
}
@property (nonatomic, retain) NSString* name;
@end
I understand that ...
96
votes
3answers
48k views
How do I apply a perspective transform to a UIView?
I'm looking to perform a perspective transform on a UIView (such as seen in coverflow)
Does anyonew know if this is possible?
I've investigated using CALayer and have run through all the pragmatic ...
70
votes
6answers
66k views
How can I upload a photo to a server with the iPhone?
I'm writing an iPhone app that takes a photo and then uploads it to a server. How do I upload a photo to a server with Cocoa in Xcode? I suppose I use NSUrl somewhere.
Thanks!
116
votes
15answers
109k views
Proper way to exit iPhone application?
I am programming an iPhone app, and I need to force it to exit due to certain user actions. After cleaning up memory the app allocated, what's the appropriate method to call to terminate the ...
130
votes
12answers
79k views
Is there a barcode recognition framework for iOS?
Is there a framework or other sample code for doing barcode recognition on iPhone / iPad?
136
votes
8answers
103k views
How can I send mail from an iPhone application
I want to send an email from my iPhone application. I have heard that the iOS SDK doesn't have an email API. I don't want to use the following code because it will exit my application:
NSString *url ...
85
votes
17answers
72k views
Is there a documented way to set the iPhone orientation?
I have an app where I would like to support device rotation in certain views but other don't particularly make sense in Landscape mode, so as I swapping the views out I would like to force the ...