views:

102

answers:

2

hi,

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

+2  A: 
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView: mySwitch] autorelease];
Graham Lee
thank's guys, you rock!:D
zebra
+2  A: 
UISwitch *foo = [[UISwitch alloc] init];
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:foo];
self.navigationItem.rightBarButtonItem = item;
[item release];
[foo release];
Can Berk Güder