I’m setting UISegmentControl programmatically in my iPhone app. By default it has 2 segment. In my code I’m populating more than two segments. How do I set this, any help?
Update
My question is how do I put more than 2 tabs on segmentController by code?
First of all segmented control in iOS is of UISegmentedControl class, not NS…
To create it with any number of segments you want you can use
initWithItems:initialize method – pass array of titles (NSStrings) or images for each segments. e.g.:Later you can change you control using
insertSegmentWithImage:atIndex:animated:,insertSegmentWithTitle:atIndex:animated:or/andremoveSegmentAtIndex:animated:methods.You can find descriptions on those (and some more!) methods in apple docs.