Reputation: 2455
here is the code:
It crashes at runtime at the line:
UISegmentedControl *segmentedControl = [[[UISegmentedControl alloc] initWithItems:toolbarItems]autorelease];
with the error
"'-[UIBarButtonItem isEqualToString:]: unrecognized selector sent to instance 0x4b2e780'"
I can't understand this error message... everything seems to be fine as in the debugger i can see that a 3 object array of bar buttons is being passed to segmented control... does anyone have an idea why I am hitting runtim errors here?
Upvotes: 0
Views: 421
Reputation: 19323
You can't pass in an array of UIBarButtonItems, only NSString or UIImage:
initWithItems: Initializes and returns a segmented control with segments having the given titles or images.
- (id)initWithItems:(NSArray *)items Parameters items An array of NSString objects (for segment titles) or UIImage objects (for segment images).
Upvotes: 2