原始代码是在iOS 7环境下编写的,因此它有两个适用于iPhone和iPad的故事板.前者使用tabVIEwController,后者使用splitVIEwController.
由于iOS 8允许我们在iPhone和iPad中使用splitVIEwController,所以我只删除iPhone故事板,并使用iPad作为通用布局.我的故事板布局是这样的:哎呀,我不能在这里发布布局图像,没有足够的声誉. click here to see the storyboard
我设置了两个segues,它们将两个tableVIEwController与最低的navigationVIEwController链接到“Show detail”.和Xcode模板“master-detail application”一样,我将splitVIEwController设置为委托自己,并将我的detailVIEwController(ImageVIEwController)的leftbarbuttonItem设置为appDelegate中的displayModebuttonItem.
- (BOol)application:(UIApplication *)application dIDFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// OverrIDe point for customization after application launch. UISplitVIEwController *splitVIEwController = (UISplitVIEwController *)self.window.rootVIEwController; UINavigationController *navigationController = [splitVIEwController.vIEwControllers lastObject]; navigationController.topVIEwController.navigationItem.leftbarbuttonItem = splitVIEwController.displayModebuttonItem; splitVIEwController.delegate = self; return YES;}
问题出在iPhone纵向模式下,“Master”后退按钮不会出现在ImageVIEwController的左上角.在iPad模式下,一切正常.
我在这里链接我的代码:code for this program.希望有人可以提供帮助.谢谢!
解决方法 我使用了展开segue技术(以编程方式)和ImageVIEwController上的自定义左栏按钮(即详细视图).- (voID)vIEwWillAppear:(BOol)animated { [super vIEwWillAppear:animated]; // Need a back button to appear when not in split vIEw i.e. iPhone mode // Wire up to unwind segue action if (!self.splitVIEwController) { UIImage *image = [UIImage imagenamed:@"ImageVIEwControllerbarBackIndicatorDefault"]; UIbarbuttonItem *btnBack = [[UIbarbuttonItem alloc] initWithImage:image style:UIbarbuttonItemStylePlain target:self action:@selector(OnClick_btnBack:)]; self.navigationItem.leftbarbuttonItem = btnBack; }}-(IBAction)OnClick_btnBack:(ID)sender { [self performSegueWithIDentifIEr:@"unwind" sender:self];}#pragma Unwind Segue- (BOol)canPerformUnwindSegueAction:(SEL)action fromVIEwController:(UIVIEwController *)fromVIEwController withSender:(ID)sender { return YES;}- (IBAction)unwindFromImageVIEwController:(UIStoryboardSegue *)unwindSegue { [self dismissVIEwControllerAnimated:YES completion:nil];}总结
以上是内存溢出为你收集整理的objective-c – IOS 8 SplitViewController iPhone模拟器肖像detailView后退按钮问题全部内容,希望文章能够帮你解决objective-c – IOS 8 SplitViewController iPhone模拟器肖像detailView后退按钮问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)