iPad UIPopoverController弹出窗口的位置和坐标
来源:互联网 发布:游鹿网络有什么游戏 编辑:程序博客网 时间:2024/06/05 23:43
转载自: http://blog.csdn.net/chang6520/article/details/7921181
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];
//最佳实践,使用哪个view做参考,就以哪个view的bounds送进去就好了,箭头自动指向这个view的中心。
[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。
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- 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弹出窗口窗口的位置和大小
- 用UISearchController实现微信搜索效果
- mysql相关问题
- RabbitMQ的安装与使用
- python 一元二次方程
- Educational Codeforces Round 34 (Rated for Div. 2) D
- iPad UIPopoverController弹出窗口的位置和坐标
- photoswipe.min.js 使用
- 谈软件项目及管理
- 在echarts中自定义提示框内容
- maven聚合项目项目间依赖时,出现错误的解决办法
- angularjs中form表单input脏值检测
- lintcode刷题记录合并排序数组 java
- vue解决POST跨域请求
- Android在Native层输出Log到本地文件