Search code examples
ipadios7uipopovercontrolleruibarbuttonitem

UIBarButtonItem not clickable in iOS7 when in UIPopoverController on iPad


I have a UIPopoverController for data input with a 'Cancel' and 'Save' button. Both work fine on iOS6. On iOS7 the buttons show up but are not clickable (neither trigger their selectors)

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;
}

Any ideas?


Solution

  • This turned out to be a UIToolbar layered over a UINavigationController. The solution was to get rid of the UINavigationController.