ios成长之每日一遍(day 5)
iOS 屏幕方向那点事儿
http://zhenby.com/blog/2013/08/20/talk-ios-orientation/
针对当前的屏幕方向进行对应的代码布局
BIDViewController.m
#import "BIDViewController.h" @interface BIDViewController () @end @implementation BIDViewController - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIApplication *app = [UIApplication sharedApplication]; // 获取单例UIApplication
UIInterfaceOrientation currentOrientation = app.statusBarOrientation; // 获取当前状态栏的方向
[self doLayoutForOrientation:currentOrientation];
} // 用于横纵屏变化的时候的切换用portrait和landscape是两个视图
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self doLayoutForOrientation:toInterfaceOrientation];
} - (void)doLayoutForOrientation:(UIInterfaceOrientation)orientation {
if (UIInterfaceOrientationIsPortrait(orientation)) { // 屏幕在垂直方向
_bigButton.frame = CGRectMake(, , , ); // 重新绘画控件的位置大小
_actionButton1.frame = CGRectMake(, , , );
_actionButton2.frame = CGRectMake(, , , );
_actionButton3.frame = CGRectMake(, , , );
_actionButton4.frame = CGRectMake(, , , );
} else { // 屏幕在横屏方向
_bigButton.frame = CGRectMake(, , , );
_actionButton1.frame = CGRectMake(, , , );
_actionButton2.frame = CGRectMake(, , , );
_actionButton3.frame = CGRectMake(, , , );
_actionButton4.frame = CGRectMake(, , , );
}
} - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
ios成长之每日一遍(day 5)的更多相关文章
- ios成长之每日一遍(day 8)
这几天都有一些任务要跟, 把ios的学习拉后, 看看要抓紧咯, 看看轮到的学习的是UITableView. BIDAppDelegate.h #import <UIKit/UIKit.h> ...
- ios成长之每日一遍(day 3)
今天要介绍一下更多的控键使用, 当然也会对上一篇说的控件做一个巩固, 所以这一篇涉及到的控键会包括 UIImage.UITextField.UIButton.UILabel.UISwitch.以及 U ...
- ios成长之每日一遍(day 1)
Hello world开始. 这里不讨论如何创建项目导入项目.由于趁上班时间打酱油所以也不谈细节, 只谈具体项目的实现与关键流程的解析, 只供本人实际程况使用.不喜请移驾. 首先来谈谈 AppDele ...
- ios成长之每日一遍(day 7)
今天到UITabBarController 结合 UIPickView, 这里一共有5个实现, 由浅到易. 其实在IB上面使用UITabBarController很简单, 就像平常拖控件一样拖到界面上 ...
- ios成长之每日一遍(day 6)
toolBar上的View Switcher BIDAppDelegate.h #import <UIKit/UIKit.h> @class BIDSwitchViewController ...
- ios成长之每日一遍(day 4)
今天, 主要讲四种常见的问题, 废话不多说了, 直接开始. 自动布局:这个我发现有一篇文章写得非常好, 直接表明出地http://www.cocoachina.com/applenews/devnew ...
- ios成长之每日一遍(day 2)
接着下来简单说说Label(相当于android的textview)和button的使用, 由于都是与上篇的AppDelegate一致, 所以这一篇就说说ViewController与xib的使用呗. ...
- iOS:从头捋一遍VC的生命周期
一.介绍 UIViewController是iOS开发中的核心控件,没有它那基本上任何功能都无法实现,虽然系统已经做了所有控件的生命维护,但是,了解它的生命周期是如何管理还是非常有必要的.网上有很多教 ...
- IOS成长之路-用NSXMLParser实现XML解析
再次对xml进行解析,又有了些理解,如果有不对的地方,请给小弟指出,谢谢! <?xml version="1.0" encoding="UTF-8"?&g ...
随机推荐
- Ubuntu服务器上相关软件或应用时常打不开的问题
于接触linux系统时间不就,所以在操作上难免会出现失误,以下两个问题就是近期经常出现的问题,具体如下: 1.ubuntu服务器上的浏览器时常打不开. 2.安装的pycharm和系统自带的pychar ...
- conda设置Python虚拟环境
conda设置Python虚拟环境 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/Co_zy/article/details/7741261 ...
- 009.KVM配置调整
一 内存CPU调整 1.1 增大虚拟机内存 [root@kvm-host ~]# virsh shutdown vm01-centos6.8 [root@kvm-host ~]# virsh edit ...
- 关于Sql Server的一些知识点的定义总结
数据库完整性:是指数据库中数据在逻辑上的一致性.正确性.有效性和相容性 实体完整性(Entity Integrity 行完整性):实体完整性指表中行的完整性.主要用于保证操作的数据(记录)非空.唯一 ...
- 学习字典才联想到要和 JSP 说再见了
最开始只是想让页面能够映射出我的字典值,然而却发现了更大的问题. 假如你自己做一个 demo ,需要前台页面映射出字典数据你会怎么做呢?大致的思路应该是有的,准备字典,准备数据,然后将两部分进行映射. ...
- Android-Activity的切换效果
Android-Activity的切换效果 Android-Activity的切换效果 Activity有一个默认的切换效果,但是有时候单一的切换效果未免单调,Activity的切换效果也是我们可以自 ...
- VA插件突然不能使用,彈出“the security key for....”
昨天打開VS莫名其妙地彈出下面的錯誤框: "the security key for this program currently stored on your system does no ...
- IllegalArgumentException: Unmatched braces in the pattern.
IllegalArgumentException: Unmatched braces in the pattern. 非法参数异常. 不匹配的 吊带 在 样品 中. === 没有管. 项目一直卡在d ...
- 洛谷P4141消失之物
题目描述 ftiasch 有 N 个物品, 体积分别是 W1, W2, …, WN. 由于她的疏忽, 第 i 个物品丢失了. “要使用剩下的 N – 1 物品装满容积为 x 的背包,有几种方法呢?” ...
- hdu 5753 Permutation Bo 水题
Permutation Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...