- (IBAction)pressAddActionbutton:(UIbarbuttonItem *)sender {if (_mode == itemSelect) { LookUptableVIEwController *vc = [self.storyboard instantiateVIEwControllerWithIDentifIEr:@"lookuptable"]; vc.key = @"Title"; vc.data = [linesheet MR_findAllSortedBy:@"Title" ascending:YES]; vc.lookUpDelegate = self; self.myPopoverController = [[UIPopoverController alloc] initWithContentVIEwController:vc]; [self.myPopoverController presentPopoverFrombarbuttonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; } else { self.mode = itemSelect;}
}
如果我使用storyBoard segue显示d出窗口 – 一切都很好,但如果我在运行时这样做,则不显示d出窗口.我应该手动创建UIbarbuttonItem.
感谢帮助!!!
更新,按钮代码:
- (voID)setupNavigationItems { self.navigationController.navigationbarHIDden = NO; UIbarbuttonItem *addItem; if (_mode == itemSelect) { addItem = [[UIbarbuttonItem alloc] initWithbarbuttonSystemItem:UIbarbuttonSystemItemAdd target:self action:@selector(pressAddActionbutton:)]; } else { addItem = [[UIbarbuttonItem alloc] initWithTitle:@"Done" style:UIbarbuttonItemStyleDone target:self action:@selector(pressDonebutton:)]; } [addItem setStyle:UIbarbuttonItemStylebordered]; UIbarbuttonItem *separator = [[UIbarbuttonItem alloc] initWithbarbuttonSystemItem:UIbarbuttonSystemItemFlexibleSpace target:self action:nil]; UIbarbuttonItem *action = [[UIbarbuttonItem alloc] initWithbarbuttonSystemItem:UIbarbuttonSystemItemAction target:self action:@selector(pressActionbutton:)]; [action setStyle:UIbarbuttonItemStylebordered]; [toolbar setItems:[NSArray arrayWithObjects:separator,addItem,action,nil] animated:YES];}解决方法 确保使用presentPopoverFrombarbuttonItem行上的断点按预期命中代码.此外,如果您正在使用arc,请确保将myPopoverController属性声明为strong,否则在呈现行之前将为nil. 总结
以上是内存溢出为你收集整理的ios – 无法使用UIBarButtonItem显示d出控制器全部内容,希望文章能够帮你解决ios – 无法使用UIBarButtonItem显示d出控制器所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)