A collection of useful iOS snippets
Open a link from a UITableViewCell, using the cell content as a URL parameter
2 NSString* thisValue = [[[self.tableView cellForRowAtIndexPath:indexPath] textLabel] text];
3
4 NSString* thisURL = [NSString stringWithFormat:@"http://www.site.co.uk?¶m=%@", thisValue
5 ];
6
7 [[UIApplication sharedApplication] openURL:[NSURL URLWithString: thisURL]];
8}
Run code in the background
2 // perform some intense heavy function
3
4 // update UI etc - do something while the background thread is running
5 dispatch_async( dispatch_get_main_queue(), ^{
6 // update progress bar type thing
7 });
8});