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 ...
随机推荐
- 德卡Z90读卡器读取社保卡,德卡Z90读卡器CSharp示例程序源码
前言,最近学习调用 医保卡业务,使用德卡读卡器,主要就是调用一个DLL,动态库文件. 借着自学的机会把心得体会都记录下来,方便感兴趣的小伙伴学习与讨论. 内容均系原创,欢迎大家转载分享,但转载的同时别 ...
- mysql 5.7 百度云网盘下载
mysql 百度云下载 链接: https://pan.baidu.com/s/1fPSEcgtDN7aU2oQ_sL08Ww 提取码: 关注公众号[GitHubCN]回复2539获取
- js 把数组对象按照某个属性进行排序
var arr=[{a:1},{a:3},{a:2}]; function objSort(prop){ return function (obj1, obj2) { var val1 = obj1[ ...
- Python - 计算个人所得税
最近在学python,写了个计算个人所得税计算的脚本,分享. 以下为python3适用版本 #!/usr/bin/python # -*- coding: UTF-8 -*- # 该python脚本用 ...
- Oracle - 数据库巡检脚本
分享一个oracle数据库巡检脚本,欢迎大家使用,希望大家在用的过程中发现脚本中的错误并提出改进意见. -- 数据库巡检脚本 -- 版本号2.1 -- 该脚本仅对数据库的做一个初步的巡检,具体的优化方 ...
- sublime text3中文乱码问题解决方案
1. 首先需要安装包convertToUTF8,安装完重启后如果仍然不能正常显示中文,则需要进行用户配置. 2.用户配置:preferences>settings 在用户设置加入一个属性:&qu ...
- js文字转语音并播放
这里调用的是百度文字转语音开放API html: <div> <input type="text" id="ttsText"> < ...
- IO写 PrintWriter
private static final String FILENAME = "c:\\temp\\out.txt"; PrintWriter pw = null; try { p ...
- lupgu P3950 部落冲突
题目链接 luogu P3950 部落冲突 题解 树剖线段树可以 lct还行 代码 #include<cstdio> #include<algorithm> inline in ...
- BZOJ2888 : 资源运输
显然资源集合处就是树的重心,这题需要动态维护树的重心. 每个连通块以重心为根,用link-cut tree维护每个点的子树大小以及子树内所有点到它的距离和. 合并两个连通块时,考虑启发式合并,暴力往大 ...