I need to implement UISegmentedControl on navigation item pro grammatically because I do not have XIB for that.
Navigation item already have title,left bar button,and right bar button
Can I put it in between left bar button and title
Also how can I give event to that Control pro grammatically?
I have used the below code:
segImport = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Own",@"Imported",nil]];
[segImport setFrame:CGRectMake(80, 0, 200, 30)];
[segImport setSegmentedControlStyle:UISegmentedControlStyleBar];
@Heena: Hi..
You just need to prepare the UISegmented Control as you normally do.
Then you need to use:
UIBarButtonItem *seg = [[UIBarButtonItem alloc] initWithCustomView:segmentControlObject];
self.navigationItem.rightBarButtonItem = seg;
Hope this helps.
EDIT:
As far as you question whether you can place it between leftbarbutton and title. Then the answer is No, You cannot do it that way.
But if you want a way to make it work/work around for that, then please feel free to contact me.