New to Objective-C iPhone/iPod touch/iPad development, but I'm starting to discover lots of power in one-liners of code such as this:
[UIApplication sharedApplication].applicationIconBadgeNumber = 10;
Which will display that distinctive red notification badge on your app iphone with the number 10.
Please share you favorite one or two-liners in Objective-C for the iPhone/iPod touch/iPad here. PUBLIC APIs ONLY.
Change the title on the back button on a UINavigationView. Use this code on the UINavigationController before pushing the view
Display an alert window:
Get the path to the Documents folder:
Push another view controller onto the Navigation Bar:
Fade away a UIView by animating the alpha down to 0:
Get the name of the app
Change the status bar to black
Change the style of the navigation bar (from in a view controller):
Save a NSString into NSUserDefaults:
Get an NSString from NSUserDefaults:
NSString* loginName = [defaults stringForKey:kUserLoginName];
Check to make sure an objects support a method before calling it:
Log the name of the class and function:
Add rounded corners and/or a border around any UIView item (self)
Open Google Maps app with directions between two lat/long points
Open an URL in Safari
Hide the status bar
Dial a Phone Number (iPhone Only)
Launch the Apple Mail
stop responding to touch events
active the touch events
Show the network Activity Indicator
Hide the network Activity Indicator
Prevents iPhone goes into sleep mode
Make the device vibrate:
Open the Messages app with a specific phone number:
Stop responding to touch events:
Start responding again:
And finally, the single line of code browser:
Save bool to User Defaults
Copy a file from x to y
Display a new view
Screen touches method
Get documents directory
Load URL
Get Current Date and time:
Own enum type:
Quartz draw arc