QQ空间HD(1)-UIPopoverController基本使用
UIPopoverController 是iPad的专属API
ViewController.m
#import "ViewController.h"
#import "DJMenuViewController.h" @interface ViewController () - (IBAction)leftItemDidClick:(id)sender; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} - (IBAction)leftItemDidClick:(id)sender { DJMenuViewController *menuVC = [[DJMenuViewController alloc] init];
UINavigationController *menuNavVC = [[UINavigationController alloc] initWithRootViewController:menuVC]; // 创建一个popoverController,注意!只能使用initWithContentViewController创建!
// 在iOS7以下的系统中,需要将popoverVC当做一个成员变量,使用一个强指针进行引用,否则在这段代码执行完毕后,popoverVC将被销毁
UIPopoverController *popoverVC = [[UIPopoverController alloc] initWithContentViewController:menuNavVC];
// 设置popoverController的内部尺寸
popoverVC.popoverContentSize = CGSizeMake(, *);
// 显示popoverController,有点类似于android里面的popview的showAsDropDown方法
[popoverVC presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; }
@end
DJMenuViewController.m
#import "DJMenuViewController.h"
#import "DJTestViewController.h" @interface DJMenuViewController() @property (nonatomic,strong) NSArray *titles; @end @implementation DJMenuViewController - (void)viewDidLoad { [super viewDidLoad];
self.titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.titles.count;
} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *ID = @"title";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
} cell.textLabel.text = self.titles[indexPath.row];
return cell;
} - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DJTestViewController *testVC = [[DJTestViewController alloc] init];
[self.navigationController pushViewController:testVC animated:YES]; } @end
DJTestViewController.m
#import "DJTestViewController.h" @implementation DJTestViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor redColor];
} @end
Main.stroyboard
最终运行效果:
QQ空间HD(1)-UIPopoverController基本使用的更多相关文章
- QQ空间HD(2)-UIPopoverController其它使用
DJTestViewController.m #import "DJTestViewController.h" #import "DJColorTableViewCont ...
- QQ空间HD(6)-实现自定义的选项卡切换效果
DJTabbarButton.m #import "DJTabbarButton.h" @implementation DJTabbarButton - (instancetype ...
- QQ空间HD(5)-添加左侧菜单栏内容
DJIconView.m #import "DJIconView.h" @implementation DJIconView - (instancetype)initWithFra ...
- QQ空间HD(4)-设置左侧菜单栏属性
DJHomeViewController.m #import "DJHomeViewController.h" #import "DJMenuView.h" ; ...
- QQ空间HD(3)-Modal的切换效果总结
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { UIViewController ...
- iOS开发UI篇—模仿ipad版QQ空间登录界面
iOS开发UI篇—模仿ipad版QQ空间登录界面 一.实现和步骤 1.一般ipad项目在命名的时候可以加一个HD,标明为高清版 2.设置项目的文件结构,分为home和login两个部分 3.登陆界面的 ...
- QQ空间动态爬虫
作者:虚静 链接:https://zhuanlan.zhihu.com/p/24656161 来源:知乎 著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 先说明几件事: 题目的意 ...
- 仿QQ空间根据位置弹出PopupWindow显示更多操作效果
我们打开QQ空间的时候有个箭头按钮点击之后弹出PopupWindow会根据位置的变化显示在箭头的上方还是下方,比普通的PopupWindow弹在屏幕中间显示好看的多. 先看QQ空间效果图: ...
- QQ空间/朋友圈类界面的搭建
类似于QQ空间的布局主要是在说说信息.点赞.回复三大部分的自适应布局上. 当我们需要搭建类似QQ空间.微信朋友圈的界面的时候,可做如下操作: 创建一个对应的model类: 创建一个对应model类的f ...
随机推荐
- 用 phylomatic 软件生成的进化树
用 phylomatic 软件生成的进化树 Phylomatic是在线软件,可以利用植物名录,按照APGIII的被子植物科的拓扑结构,生成进化树. 参考 张金龙博士 工作目录 setwd(" ...
- C# 开源项目一
商业协作和项目管理平台-TeamLab 网络视频会议软件-VMukti 驰骋工作流程引擎-ccflow [免费]正则表达式测试工具-Regex-Tester Windows-Phone-7-SDK E ...
- CF715C:Digit Tree
传送门 一句话怎么说来着 算法+高级数据结构=OI 现在我感觉到的是 我会的算法+我会的高级数据结构=WA 这道题提交了三四十次,从刚看题到完全写好花了好几天..,主要死于看错费马小定理的适用条件. ...
- zabbix使用介绍
zabbix自定义监控项 1.创建主机组,可以根据redis.mysql.web等创建对于的主机组 2.创建主机 3.创建Screens 4.自定义监控项 zabbix_agentd.conf配置文件 ...
- C#调用WebService实现天气预报
http://zhangkui.blog.51cto.com/1796259/497324/ 本文使用Winform (C#)调用互联网上公开的WebServices(http://www.webxm ...
- sql 编写横竖表转换
将横表转为竖表,基本思想是: 1)将横表的多条数据,"压"成一条.相当于将这么多条分组,每组"压"成一条数据.利用group by 2) 再对竖表中的列,由特定 ...
- Git创建ssh-key
打开git bash界面,输入: ssh-keygen -t rsa -C "yourname@email.com" 一路回车,后续保持默认值即可. 把C:\users\yourn ...
- base64 json
javascript将base64编码的图片数据转换为file并提交 直接提交base64编码图片数据,过大的话后台会出现转发错误问题. 一个不错的解决方式就是将base64编码的图片数据转换为Blo ...
- html img src base64
网页上有些图片的src或css背景图片的url后面跟了一大串字符,比如:data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAYAAABId ...
- jquery serialize()方法可以序列化表单值为字符串
<form> <div><input type="text" name="a" value="1" id=&q ...