UISegmentedControl change event not firing in iOS5

This is a change in iOS 5 in order for UISegmentedControl to be consistent with all other controls. The idea is that the action should only fired automatically as a result of user interaction. Prior to iOS 5, UISegmentedControl‘s actions would be fired because of user interaction and programmatic interaction. However, initiating the change programmatically … Read more

Custom UISegmentedControl

I had to add this extra code, in addition to having 2 different states for the “on” and “off” positions: – (void)viewDidLoad { [super viewDidLoad]; // Set set segControl background to transparent CGRect rect = CGRectMake(0, 0, 1, 1); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]); CGContextFillRect(context, rect); UIImage *transparentImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); … Read more

Switching ViewControllers with UISegmentedControl in iOS5

This code works pretty well for your purpose, I use it for one of my new apps. It uses the new UIViewController containment APIs that allow UIViewControllers inside your own UIViewControllers without the hassles of manually forwarding stuff like viewDidAppear: – (void)viewDidLoad { [super viewDidLoad]; // add viewController so you can switch them later. UIViewController … Read more

tech