Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding uiswich as navigation item

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

like image 979
zebra Avatar asked Nov 26 '25 21:11

zebra


2 Answers

self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView: mySwitch] autorelease];
UISwitch *foo = [[UISwitch alloc] init];
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:foo];
self.navigationItem.rightBarButtonItem = item;
[item release];
[foo release];
like image 23
Can Berk Güder Avatar answered Nov 28 '25 13:11

Can Berk Güder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!