我创建了一个 UISegmentedControl 并成功地将它附加到我的 navigationItem.tableView。
但是当我尝试将它附加到 UIToolbar 时,它会爆炸。
我确定我以前在工具栏上看到过 UISegementedControls - 但似乎无法让它工作。想法?
// works
NSArray *statusItems = [[NSArray alloc] initWithObjects:@"one", @"two", nil];
statusSegments_ = [[UISegmentedControl alloc] initWithItems:statusItems];
self.navigationItem.titleView = statusSegments_;
// doesn't work
NSArray *statusItems = [[NSArray alloc] initWithObjects:@"one", @"two", nil];
statusSegments_ = [[UISegmentedControl alloc] initWithItems:statusItems];
NSArray *toolbarItems = [[NSArray alloc] initWithObjects:statusSegments_, nil];
self.toolbarItems = toolbarItems;
[toolbarItems release];
[会议于 2010-01-01 13:40:35 -0600 开始。]
2010-01-01 13:40:35.182 TimeSheet[15382:20b] ***-[UISegmentedControl 视图]:无法识别的选择器发送到实例 0x3f5c3e0
2010-01-01 13:40:35.183 TimeSheet[15382:20b] *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“***-[UISegmentedControl 视图]:无法识别的选择器发送到实例 0x3f5c3e0”
2010-01-01 13:40:35.184 时间表 [15382:20b] 堆栈:(
10847323,
2479902267,
11229243,
10798710,
10651330,
24428622,
24429410,
24133352,
24133878,
11379,
24149733,
24130330,
24151483,
24129979,
23770,
23906970,
23890136,
2838970,
10631872,
10628168,
960429,
960626,
23633923
)