Streaming Radio

#import <MediaPlayer/MPMoviePlayerController.h>

MPMoviePlayerController* player;
NSURL *theURL = [NSURL URLWithString:@"http://someurl.com"];
player = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
[player prepareToPlay];
...
[player play];

Disable the UITableView Selection Highlighting

cell.selectionStyle = UITableViewCellSelectionStyleNone;

Sort Array by Number

NSArray *order = [order sortedArrayUsingComparator: ^(id first, id second) {
return [(NSString *)first compare:(NSString *)second options: NSNumericSearch];
}];

Sort Array

NSArray *myArray = [myArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];

or

NSSortDescriptor *lastNameDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastName" ascending:YES];
[myArray sortUsingDescriptors:[NSArray arrayWithObject:lastNameDescriptor]];

Change Default Scrolling Behavior of UITableView Section Header

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

CGFloat sectionHeaderHeight = 40;

if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {

scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);

} else if (scrollView.contentOffset.y>=sectionHeaderHeight) {

scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);

}

}

Map View Load Address

-(CLLocationCoordinate2D) getLocationFromAddressString:(NSString*) addressStr {
NSString *urlStr = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",
[addressStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *locationStr = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlStr]];
NSArray *items = [locationStr componentsSeparatedByString:@","];

double lat = 0.0;
double long = 0.0;

if([items count] >= 4 && [[items objectAtIndex:0] isEqualToString:@"200"]) {
lat = [[items objectAtIndex:2] doubleValue];
long = [[items objectAtIndex:3] doubleValue];
}
else {
NSLog(@"Address, %@ not found: Error %@",addressStr, [items objectAtIndex:0]);
}
CLLocationCoordinate2D location;
location.latitude = lat;
location.longitude = long;

return location;
}

Change Textfield Vertical Alignment

textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;