Question

in which way i can add programmatically an uiswitch as navigation items or btw on my navigation bar? i'm going crazy :D

Was it helpful?

Solution

self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView: mySwitch] autorelease];

OTHER TIPS

UISwitch *foo = [[UISwitch alloc] init];
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:foo];
self.navigationItem.rightBarButtonItem = item;
[item release];
[foo release];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top