zoukankan      html  css  js  c++  java
  • UIPopoverController

          围绕着某一块特定区域显示(箭头指定那块特定区域)

    • - (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;

      • rect :指定箭头所指区域的矩形框范围(位置和尺寸)
      • view rect参数是以view的左上角为坐标原点(00
      • arrowDirections :箭头的方向
      • animated :是否通过动画显示出来
    •   
    •  
    • 默认情况下
    • 只要UIPopoverController显示在屏幕上,UIPopoverController背后的所有控件默认是不能跟用户进行正常交互的
    • 点击UIPopoverController区域外的控件,UIPopoverController默认会消失
    • 要想点击UIPopoverController区域外的控件时不让UIPopoverController消失,解决办法是设置passthroughViews属性

    @property (nonatomic, copy) NSArray *passthroughViews;

    • 这个属性是设置当UIPopoverController显示出来时,哪些控件可以继续跟用户进行正常交互。这样的话,点击区域外的控件就不会让UIPopoverController消失了

    ----------------------------------------------------------------------------------

    • 如果想让箭头指向某一个UIView的做法有2种做法,比如指向一个button
    • 方法1

    [popover presentPopoverFromRect:button.bounds inView:button permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

     

    • 方法2

    [popover presentPopoverFromRect:button.frame inView:button.superview permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

     

    ---------------------------------------------------------------------------------

     

    • 在popover的使用过程中,经常会遇到这个错误

    -[UIPopoverController dealloc] reached while popover is still visible.

    • 错误的大体意思是:popover在仍旧可见的时候被销毁了(调用了dealloc)
    • 从错误可以得出的结论
    • 当popover仍旧可见的时候,不准销毁popover对象
    • 在销毁popover对象之前,一定先让popover消失(不可见)

    ------------------------------------------------------------------------

    • UIPopoverController这个类是只能用在iPad中的
    • 要想在iPhone中实现popover效果,必须得自定义view,可以参考
  • 相关阅读:
    Eclipse对printf()不能输出到控制台的解决方法
    Eclipse launch failed.Binary not found解决方案
    Windows 7中使用Eclipse 使用CDT and WinGW 开发C/C++(转载)
    assets
    方法对头,报表模板维护其实很简单
    刷机包各个文件都是啥
    开机logo切换逻辑深入研究
    不同分辨率的LCM进行兼容
    SD卡驱动分析(二)
    SD卡驱动分析(一)
  • 原文地址:https://www.cnblogs.com/liuzhenjie/p/5447386.html
Copyright © 2011-2022 走看看