IOS 随笔记录

来源:互联网 发布:网络网页优化方案 编辑:程序博客网 时间:2024/06/06 06:50
一、IOS 关闭键盘:

1、让所有控件的键盘隐藏

// 这个方法可以让整个view取消第一响应者,从而让所有控件的键盘隐藏[self.view endEditing:YES];

2、让某个textFiled的取消第一响应者

// 让某个textFiled的取消第一响应者[textField resignFirstResponder];

二、IOS 动画:(transform 属性

1、透明度 ,取值范围0~1.0(透明~不透明)。

// 透明度 ,取值范围0~1.0(透明~不透明)。_btn.alpha = 1.0f;

2、旋转

// 固定左旋45°_btn.transform = CGAffineTransformMakeRotation(- M_PI_4);// 每次执行都在原来基础上旋转45度_btn.transform = CGAffineTransformRotate(_btn.transform, M_PI_4 );

3、缩放

// 缩放0.8_btn.transform = CGAffineTransformMakeScale(0.8, 0.8);// 在原来基础上缩放0.8_btn.transform = CGAffineTransformScale(_btn.transform, 0.8, 0.8);

4、清空之前所有的形变状态(消除以前的旋转、缩放等状态)

_btn.transform = CGAffineTransformIdentity;

5、常用方法

// 方法一:0.3 表示执行时间[UIView animateWithDuration:0.3 animations:^{      // 执行动画代码}];// 方法二:0.3 表示执行时间[UIView animateWithDuration:0.3 animations:^{      // 执行动画代码} completion:^(BOOL finished) {      // 上面的动画执行完毕后执行}];

三、解析plist文件来创建数组对象

NSBundle *bundle = [NSBundle mainBundle]; // C++NSString *path = [bundle pathForResource:@"descs" ofType:@"plist"];_allDescs = [NSArray arrayWithContentsOfFile:path];

三、iOS8.0模拟器,改语言设置

Product->scheme->Edit Scheme->Options->Application Region改为中国就OK了

 

0 0