zoukankan      html  css  js  c++  java
  • UIPopoverController and Modal View Controllers(13)

    // Create a new popover controller that will display the imagePicker imagePickerPopover = [[UIPopoverController alloc]

    initWithContentViewController:imagePicker];

    [imagePickerPopover setDelegate:self];

    // Display the popover controller; sender
    // is the camera bar button item
    [imagePickerPopover presentPopoverFromBarButtonItem:sender 
    permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

    To dismiss a modally-presented view controller, you must send the message dismissViewControllerAnimated:completion: to the view controller that presented it. You’ve done this before with UIImagePickerController – the DetailViewController presented it, and when the image picker told the DetailViewController it was done, the DetailViewController dismissed it.

    Now, we have a slightly different situation. When a new item is created, the ItemsViewController presents the DetailViewController modally. The DetailViewController has two buttons on its navigationItem that will dismiss it when tapped: Cancel and Done. There is a problem here: the action messages for these buttons are sent to the DetailViewController, but it is the responsibility of the ItemsViewController to do the dismissing. The DetailViewController needs a way to tell the view controller that presented it, “Hey, I’m done, you can dismiss me now.”

    Fortunately, every UIViewController has a presentingViewController property that points to the view controller that presented it. The DetailViewController will grab a pointer to its presentingViewController and send it the message dismissViewControllerAnimated:completion:.

    Implement the action method for the Save button in DetailViewController.m

    [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; 

    There are two built-in properties for managing the relationship between presenter and presentee. A modally-presented view controller’s presentingViewController will point back to the view controller that presented it, while the presenter will keep a pointer to the presentee in its presentedViewController property 

    Presentation context 

    (不是很理解)

    参考信息:https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

    page184

  • 相关阅读:
    边缘节点 如何判断CDN的预热任务是否执行完成刷新 路由追踪 近期最少使用算法
    查看恶意登录的尝试账号
    系统启动时发生了什么?
    JMS学习(五)--ActiveMQ中的消息的持久化和非持久化 以及 持久订阅者 和 非持久订阅者之间的区别与联系
    查找最近修改过的文件 并处理
    时间写入文件名 nohup 原理 Command In Background your shell may have its own version of nohup
    nohup COMMAND > FILE
    证明即程序、结论公式即程序类型
    C++学习注意
    C++标准库简介(转)
  • 原文地址:https://www.cnblogs.com/zhangjl/p/3639302.html
Copyright © 2011-2022 走看看