我有一个用于数据输入的UIPopoverController,带有“取消”和“保存”按钮。两者都适用于iOS6。在iOS7上,按钮显示但不可点击(既不触发选择器)
cancelButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancel)];
saveButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStyleDone target:self action:@selector(save)];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
NSMutableArray * arr = [NSMutableArray arrayWithObjects:cancelButtonItem,flexibleSpace, saveButtonItem, nil];
[_toolbar setItems:arr animated:YES];
} else {
//iPhone
self.navigationItem.leftBarButtonItem = cancelButtonItem;
self.navigationItem.rightBarButtonItem = saveButtonItem;
}
有什么想法吗?
答案 0 :(得分:0)
这是一个UIToolbar,分层在UINavigationController上。解决方案是摆脱UINavigationController。