菜鸟教程小白 发表于 2022-12-12 17:40:41

objective-c - iPad Split View 从另一个 View 调用/加载


                                            <p><p>请帮我解决下面提到的问题。</p>

<p>我的问题是,是否有办法从另一个 View 调用 Split View,比如在我点击一个按钮之后......?</p>

<p>例如,如 <a href="http://www.myimagespace.com/public/view/full/7897" rel="noreferrer noopener nofollow">attached pic</a> 中所示,当应用启动时,它会显示第一个屏幕。</p>

<p>当用户点击“点击”按钮时, Split View打开。</p>

<p>用户能够执行 Split View的所有操作,当他按下主页按钮时,他应该回到第一个屏幕。</p>

<p>这可能吗..?我该怎么办呢..?</p>

<p>我是初学者。任何有关代码的帮助将不胜感激..</p>

<p>PS:我曾尝试使用MGSplitView和TOSplitView,但未能实现上述问题的解决方案。</p>

<p>谢谢...</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>检查以下代码。这应该可以轻松帮助您解决问题。</p>

<pre><code>   //Intialise the 2 views root and detail
    RootViewController * rootVC = [ initWithStyle:UITableViewStylePlain];

    //To show the nav bar for root, add it into a UINavigationController
    UINavigationController * rootVCNav = [ initWithRootViewController:rootVC];


    DetailViewController * detailVC = [ initWithNibName:@&#34;DetailView&#34; bundle:nil];

    //initialise split view
    splitVC = [ init];
    splitVC.viewControllers = ;

    //Tell the split view that its delegate is the detail view.
    splitVC.delegate = detailVC;
    //tell root that the changes need to be shown on detail view.
    rootVC.detailViewController = detailVC;


    ;
    ;
    ;

    //Here, we get the app delegate object of the project
    ProjectAppDelegate * appDel = (ProjectAppDelegate*)[ delegate];

    //get window object of the delegate
    UIWindow * window1 = ;
    //get the navigation controler of the window of app delegate.
    mainNav = ;

    //remove the current view from the window.
    ;

    //add the split view to the window
    ;
</code></pre>

<p>希望对你有所帮助..</p>

<p>问候,
梅尔文</p></p>
                                   
                                                <p style="font-size: 20px;">关于objective-c - iPad Split View 从另一个 View 调用/加载,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/7565054/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/7565054/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: objective-c - iPad Split View 从另一个 View 调用/加载