iPad UIPopoverController弹出窗口的位置和坐标
来源:互联网 发布:linux怎样浏览网页 编辑:程序博客网 时间:2024/05/16 15:22
TodoViewController *contentViewController = [[TodoViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:contentViewController];
navigationController.contentSizeForViewInPopover = CGSizeMake(100, 100); //内容大小
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:navigationController];
popover.popoverContentSize = CGSizeMake(300, 300); //弹出窗口大小,如果屏幕画不下,会挤小的。这个值默认是320x1100
CGRect popoverRect = CGRectMake(200, 700, 10, 10);
[popover presentPopoverFromRect:popoverRect //popoverRect的中心点是用来画箭头的,如果中心点如果出了屏幕,系统会优化到窗口边缘
inView:self.view //上面的矩形坐标是以这个view为参考的
permittedArrowDirections:UIPopoverArrowDirectionDown //箭头方向
animated:YES];
[contentViewController release];
[navigationController release];
先看名字presentPopoverFromRect,from矩形,什么意思,就是说这个popover是出自,来自这个矩形,形象地说就是这个矩形产生出一个用箭头指向的popover.看下面的图,无非这四种情况。这里的四个参数,就是下图中小矩形的参数,大矩形就是
popover。看图就是简单明了,直接了当,不要再说什么矩形中点了,只要确定了小矩形,确定了箭头方向(相对于大矩形),就确定了popover的位置。一般这个小矩形都是button,item什么的。
情况描述:多个button控制对应的UIPopoverController,当一个UIpopverController_A打开的时候,点击button_B去打开另外一个UIPopverContrller_B,每次都需要点击两下才能打开,(我的理解)第一次只是关闭UIpopverController_A,第二次才是打开UIPopverContrller_B。
[popover presentPopoverFromRect:((UIView *)tableview).frame//将popover与tableview视图相关联
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp//箭头方向
animated:YES];
popover.popoverContentSize = CGSizeMake(300, 300); //弹出窗口大小。这个没什么好说的,就是大小,当然不能超过屏幕。
[popover presentPopoverFromRect: CGRectMake(x0, y0, x1, y1);
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionDown //箭头方向
animated:YES];
先看名字presentPopoverFromRect,from矩形,什么意思,就是说这个popover是出自,来自这个矩形,形象地说就是这个矩形产生出一个用箭头指向的popover.看下面的图,无非这四种情况。这里的四个参数,就是下图中小矩形的参数,大矩形就是
popover。看图就是简单明了,直接了当,不要再说什么矩形中点了,只要确定了小矩形,确定了箭头方向(相对于大矩形),就确定了popover的位置。一般这个小矩形都是button,item什么的。
最后需要注意的是iPad的状态栏20个像素,导航栏44个像素,如果不准确的话,考虑一下二者的因素。一般情况下如果能准确定位图中的三角箭头的顶角的坐标,直接就用它作为前两个参数,而后两个参数为0就可以了,这就把矩形缩小为一个点了,也是正确的。Over!
多个UIPopoverController的切换问题
情况描述:多个button控制对应的UIPopoverController,当一个UIpopverController_A打开的时候,点击button_B去打开另外一个UIPopverContrller_B,每次都需要点击两下才能打开,(我的理解)第一次只是关闭UIpopverController_A,第二次才是打开UIPopverContrller_B。
解决方法:
UIPopoverController * poper...
UIButton * BtnA...
NSArray *array=[NSArray arrayWithObjects:BtnA,BtnB,BtnC,BtnD,BtnE,BtnF,BtnG,BtnH];
poper.passthroughViews=array;
设置passthroughViews为这个数组就可以了~
UIButton * BtnA...
NSArray *array=[NSArray arrayWithObjects:BtnA,BtnB,BtnC,BtnD,BtnE,BtnF,BtnG,BtnH];
poper.passthroughViews=array;
设置passthroughViews为这个数组就可以了~
UIPopoverController如何改变边框颜色?
http://www.cocoachina.com/bbs/simple/?t25154.html 1 0
- iPad UIPopoverController弹出窗口的位置和坐标初探
- iPad UIPopoverController弹出窗口的位置和坐标
- iPad UIPopoverController弹出窗口的位置和坐标
- iPad UIPopoverController弹出窗口的位置和坐标
- iPad UIPopoverController弹出窗口的位置和坐标
- iPad UIPopoverController弹出窗口的位置和坐标——再探
- iPad UIPopoverController弹出窗口的位置和坐标——终结篇
- IOS4 -- UIPopoverController弹出窗口的位置和坐标
- IOS4 -- UIPopoverController弹出窗口的位置和坐标
- iOS4 - UIPopoverController弹出窗口的位置和坐标(转载)-待整理
- iOS 弹出窗 UIPopoverController 的使用和 位置控制
- UIPopoverController 的使用方法 Ipad
- 弹出窗口的显示和位置PopUpManager
- ipad中 UIPopoverController 的使用方法
- ipad 中的 UIPopoverController的使用
- iPad开发,UIPopoverController的使用
- JS弹出窗口窗口的位置和大小
- JS弹出窗口窗口的位置和大小
- iOS - UI: 动画汇总二(学习日记)
- StrictMode使用详解,strictmode
- 互联网产品从设计到运营
- hdu-1251-统计难题(字典树)
- 畅通工程续 hdu 1874
- iPad UIPopoverController弹出窗口的位置和坐标
- input标签name与value区别
- 大数据如何帮助移动端企业进行决策
- NSArray与NSMutableArray 数组与可变数组的创建和遍历
- 安装 GitLab8.x
- 理解SVM的三层境界-支持向量机通俗导论
- OS 10.11 cocoaPod 使用,详细教程
- Java 工程师成神之路
- Shader基于片段编程的Lambert光照,Phong光照和Blinn-Phong光照