在iPad上的UIPopoverController中,UIBarButtonItem在iOS7中无法点击

时间:2013-10-02 09:08:26

标签: ipad ios7 uipopovercontroller uibarbuttonitem

我有一个用于数据输入的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;
}

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

这是一个UIToolbar,分层在UINavigationController上。解决方案是摆脱UINavigationController。