ios – dismissViewControllerAnimated无效

ios – dismissViewControllerAnimated无效,第1张

概述我在 IOS6上使用Storyboard.我试图回到以前的viewcontroller,但它无法正常工作. 我在这里定制了我的后门按钮. UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeCustom];btnBack.frame = CGRectMake(0, 0, 45,35);[btnBack setTitle:@"Back 我在 IOS6上使用Storyboard.我试图回到以前的vIEwcontroller,但它无法正常工作.

我在这里定制了我的后门按钮.

UIbutton *btnBack = [UIbutton buttonWithType:UIbuttonTypeCustom];btnBack.frame = CGRectMake(0,45,35);[btnBack setTitle:@"Back" forState:UIControlStatenormal];[btnBack.TitleLabel setFont: [UIFont FontWithname:@"CourIEr" size:15]];btnBack.layer.cornerRadius=5.0;btnBack.layer.borderWIDth=2.0;[btnBack setBackgroundcolor:[UIcolor colorFbBlue]];btnBack.layer.bordercolor=[UIcolor colorFbBlue].CGcolor;[btnBack setTitlecolor:[UIcolor whitecolor] forState:UIControlStatenormal];[btnBack addTarget:self action:@selector(Click_On_Btn_Back) forControlEvents:UIControlEventtouchUpInsIDe];UIbarbuttonItem *backbarbutton = [[UIbarbuttonItem alloc] initWithCustomVIEw:btnBack];-(voID)Click_On_Btn_Back{[self dismissVIEwControllerAnimated:YES completion:nil]; }

这就是我从前一个视图控制器推送segue的方式.

if([segue.IDentifIEr isEqualToString:@"segueFbShare"]){    FbShareVIEwController *fbVC=[segue destinationVIEwController];    fbVC.imageUrl=self.product.ImageUrl;}
解决方法 使用UINavigationController时转到上一个UIVIEwController:
[self.navigationController popVIEwControllerAnimated:YES];

将这行代码放在Click_On_Btn_Back方法中

总结

以上是内存溢出为你收集整理的ios – dismissViewControllerAnimated无效全部内容,希望文章能够帮你解决ios – dismissViewControllerAnimated无效所遇到的程序开发问题。

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

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

原文地址:https://54852.com/web/1109181.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存