ios – 无法使用UIBarButtonItem显示d出控制器

ios – 无法使用UIBarButtonItem显示d出控制器,第1张

概述我使用storyboard为我的项目开发UI.有很多问题都解决了,但这个问题让我很难过.我为UIBarButtonItem添加了 *** 作: - (IBAction)pressAddActionButton:(UIBarButtonItem *)sender {if (_mode == itemSelect) { LookUpTableViewController *vc = [self. 我使用storyboard为我的项目开发UI.有很多问题都解决了,但这个问题让我很难过.我为UIbarbuttonItem添加了 *** 作:

- (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出控制器所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1034701.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存