iOS cheat sheet
Sizes
Screen size
[[UIScreen mainScreen] bounds];
Application Frame = ScreenSize - Status bar
[[UIScreen mainScreen] applicationFrame];
Keyboard
Keyboard show and hide events
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
Format a date
static NSDateFormatter* dateFormatter = nil;
if(dateFormatter == nil){
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy-MM-dd";
}
NSDate *date = ...
NSString *dateStr = [dateFormatter stringFromDate:date];