UISegmentedControl
をUINavigationController
のツールバーに追加しようとしています
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.toolbarHidden = FALSE;
UIBarButtonItem *test1 = [[UIBarButtonItem alloc] initWithTitle:@"Groups"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(done)];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:@[@"Groups", @"Regions", @"Objects"]];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
[self setToolbarItems:[NSArray arrayWithObjects:test1, segmentedControl, nil]];
}
これにより、次のエラーが発生します。
-[UISegmentedControl view]: unrecognized selector sent to instance 0x295623c0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISegmentedControl view]: unrecognized selector sent to instance 0x295623c0'
を省略するとUISegmentedControl
、問題なくロードされます。
私は何を間違っていますか?