IOS 在iphone中PopoverViewController的使用
来源:互联网 发布:淘宝购物运费险怎么用 编辑:程序博客网 时间:2024/06/05 19:01
@property(nonatomic,retain)PopoverViewController *myPopover;
-(void)popover{
_myPopover = [[PopoverViewControlleralloc]initWithNibName:@"PopoverViewController"bundle:nil];
_myPopover.preferredContentSize =CGSizeMake(297,165);
_myPopover.modalPresentationStyle =UIModalPresentationPopover;
_myPopover.popoverPresentationController.sourceView =rightButton; //rect参数是以view的左上角为坐标原点(0,0)
_myPopover.popoverPresentationController.sourceRect =rightButton.bounds;//指定箭头所指区域的矩形框范围(位置和尺寸),以view的左上角为坐标原点
// CGRect frame = CGRectMake(50, 80, 297, 165);
// myPopover.popoverPresentationController.sourceRect = frame;
_myPopover.popoverPresentationController.permittedArrowDirections =UIPopoverArrowDirectionUp;//箭头方向
NSMutableArray *saveArr = [[NSUserDefaultsstandardUserDefaults]objectForKey:@"saveColor"];
if(saveArr.count){
if([saveArr[0] floatValue] ==0.0){
_myPopover.popoverPresentationController.backgroundColor = [UIColor colorWithRed:46.0/255.0 green:46.0/255.0 blue:46.0/255.0 alpha:1.0];
}else{
_myPopover.popoverPresentationController.backgroundColor = [UIColor whiteColor];
}
}else{
_myPopover.popoverPresentationController.backgroundColor = [UIColor whiteColor];
}
_myPopover.popoverPresentationController.delegate = self;
[self presentViewController:_myPopover animated:YES completion:nil];
}
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controlle
{
return UIModalPresentationNone;
}
在PopoverViewController.m 中完成布局及设置
self.popoverView.frame =CGRectMake(50,80,297, 165);
一个很好的博客链接加在这里:http://blog.csdn.net/heng615975867/article/details/43967403- IOS 在iphone中PopoverViewController的使用
- 在ios iphone编程中使用封装的NSLog来打印调试信息
- 在ios iphone编程中使用封装的NSLog来打印调试信息
- 在ios iphone编程中使用封装的NSLog来打印调试信息
- 在ios iphone编程中使用封装的NSLog来打印调试信息
- 在ios iphone编程中使用封装的NSLog来打印调试信息
- 在ios iphone编程中使用封装的NSLog来打印调试信息
- 在ios iphone编程中使用封装的NSLog来打印调试信息
- (暴力调试控的福音)在ios iphone编程中使用封装的NSLog来打印调试信息
- ios 编程: ipad 和 iphone开发中使用 UIWebView 来播放视频的时候,在页面切换时 停止播放
- ios 编程: ipad 和 iphone开发中使用 UIWebView 来播放视频的时候,在页面切换时 停止播放
- iphone ios Block的使用
- iphone ios 如何在xcode中使用静态库(static lib),并能调试
- iphone ios 如何在xcode中使用静态库(static lib),并能调试
- iphone ios MPMoviePlayerController在ios 6 模拟器中无法播放
- 在iphone中使用自定义字体
- 在iphone中使用自定义字体
- 【iPhone Xcode】在Xcode3中使用SVN
- SQLLDR
- linux性能监控工具
- uva10603
- mac上一键配置和安装adb驱动或者环境
- 在ubuntu中,终止一个进程或终止一个正在运行的程序
- IOS 在iphone中PopoverViewController的使用
- 实现一个go语言的简单爬虫来爬取CSDN博文(一)
- 4-11 求自定类型元素序列的中位数
- 安装PIL库
- 【C++ STL应用与实现】23: 如何使用std::mem_fn (since C++11)
- uva10422
- Java多线程总结(7)synchronized的缺陷及concurrent.locks包类结构简介
- 从UNIX和LINUX的发展史中看区别
- 4-12 判断奇偶性