UITableView

1. Disable highlighted cell

cell.selectionStyle = UITableViewCellSelectionStyleNone; 
 
- or -
 
[self.tableView deselectRowAtIndexPath:indexPath animated:NO];

UI

1. Transparent UILabel

myLabel.backgroundColor = [UIColor clearColor];

2. Resizing an Image

CGRect rect = CGRectMake(0.0f, 0.0f, 320.0f, 460.0f);
UIGraphicsBeginImageContext(CGSizeMake(320.0f, 460.0f));
[image drawInRect:rect];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Strings

1. Trimming

NSString *strResponseTrimmed = [strResponse stringByTrimmingCharactersInSet: 
[NSCharacterSet whitespaceAndNewlineCharacterSet]];

2. Escaping ‘%’.

Use '%%'
 
NSString *sqlString = [NSString stringWithFormat:@"SELECT poi_id, en_name FROM poi WHERE Upper(en_name) LIKE '%%%@%%' LIMIT 100", text];

3. Escaping for URL

NSString *bodyDirty = [NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@", poi.en_name, poi.en_fullpoiadd, poi.py_fullpoiadd, poi.tel_no, poi.fax_no, poi.email];
NSString *bodyClean = [bodyDirty stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

Date

1. Current Date

NSString *timestamp = [NSString stringWithFormat:@"%0.0f", [[NSDate date] timeIntervalSince1970]];
 
Or if you want the unix time as a NSString without decimals:
 
NSString *timestamp = [NSString stringWithFormat:@"%d", (long)[[NSDate date] timeIntervalSince1970]];

Debugging

1. Using the static Clang Analyzer

scan-build -k -V xcodebuild -configuration Debug -sdk iphonesimulator3.1

2. Always remove physically the files from the build directory when testing.

3. Where is the application bundle directory?
/Users/rupert/Library/Application Support/iPhone Simulator/User/Applications

Misc

1. Application Icon

Drop a Icon.png (57 x 57 pixels) in the project root directory.

2. Calling safari to launch a URL

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];

3. Calling a number

- (void)callNumber:(NSString *)_number{
	NSString *callToURLString = [NSString stringWithFormat:@"tel:+%@", _number];
	if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:callToURLString]])
	{
		// there was an error trying to open the URL. We'll ignore for the time being.
		NSLog(@"This will not work on the simulator. Need to test in the device");
	}   
}

4. Cancelling operations

	[operation cancelAllOperations]
 
	or 
 
	NSArray *arrayOperations = [operationQueue operations];
	for(int i=; i < [arrayOperations count]; i++){
		NSOperation *operation = (NSOperation *)[arrayOperations objectAtIndex:i];
		if( [operation isExecuting] ){
			NSLog(@"cancelOperations: found an operation running. Cancelling...");
			[operation cancel];
		}
	}