Escape code for % sign in NSString

The escape code for a percent sign is “%%”, so your code would look like this

[NSString stringWithFormat:@”%d%%”, someDigit];

This is also true for NSLog() and printf() formats.

Cited from

Blogged with the Flock Browser

How to show button popover on iPad

CGRect contentRect = CGRectMake(0, 0, 200, 40);
UIButton *source = [UIButton buttonWithType:UIButtonTypeCustom];
source.frame = contentRect;

source.titleLabel.text = @”Delete”;

source.backgroundColor = [UIColor redColor];

UIViewController* popoverContent = [[UIViewController alloc] init];
popoverContent.view = source;

popoverContent.contentSizeForViewInPopover = contentRect.size;

UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];

[popoverController presentPopoverFromRect:[sender frame]

[popoverContent release];

Blogged with the Flock Browser

Tags: , ,