UISplitViewController:如何通过按钮事件而不是通过滑动手势在详细视图中显示主视图 [英] UISplitViewController : how to present master view in the detail view by button event instead of via a swipe gesture

查看:27
本文介绍了UISplitViewController:如何通过按钮事件而不是通过滑动手势在详细视图中显示主视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

滑动手势很酷,可以纵向显示主视图.但我想知道如何通过按钮事件而不是通过滑动手势来呈现表格.我不想呈现 popover,我喜欢幻灯片动画.任何意见将不胜感激.

Swipe gesture is cool to present master view in portrait orientation. But I want to know how to present the table by button event instead of via a swipe gesture. I do not want to present popover, I like the slide animation. Any comments will be appreciated.

推荐答案

为了将来参考,通过设置拆分视图控制器委托并实现这两个方法,您应该准备好了.

For future reference, by setting the split view controller delegate and implementing this two methods you should be ready to go.

- (void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)button
    {
        //remove button from navigation bar in detail navigation controller
        ((UINavigationController*)[svc.viewControllers objectAtIndex:1]).topViewController.navigationItem.leftBarButtonItem = nil;
    }

- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc{

        //add button to navigation bar in detail navigation controller
        barButtonItem.title = @"Navigation";
        ((UINavigationController*)[svc.viewControllers objectAtIndex:1]).topViewController.navigationItem.leftBarButtonItem = barButtonItem;

    }

barButtonItem 的实例为您处理所有切换过程.

The instance of barButtonItem handles all the toggle process for you.

这篇关于UISplitViewController:如何通过按钮事件而不是通过滑动手势在详细视图中显示主视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆