ios代码分块管理的一些方法
2016-01-07 18:56
330 查看
内联写法:
self.backgroundView = ({UIView *view = [[UIView alloc] initWithFrame:self.view.bounds];
view.backgroundColor = [UIColor redColor];
view.alpha = 0.8f;
view;
});
[self.view addSubview:self.backgroundView];
block写法:
self.backgroundView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];void (^blackView)(UIView *) = ^(UIView *view) {
view.backgroundColor = [UIColor blackColor];
};
blackView(self.backgroundView);
[self.view addSubview:self.backgroundView];
相关文章推荐
- 在iOS7中修改状态栏字体的颜色
- iOS划线代码
- ios iPhone的一些基础知识,扫盲
- iOS倒计时,显示剩余天、时、分、秒
- iOS 解决LaunchScreen中图片加载黑屏问题
- RedHat 6.5(x86_64)启动nagios客户端nrpe报错的解决方法
- iOS常见手势总结-单击、双击、捏合、旋转、移动、清扫、长按
- iOS 支付宝的使用
- IOS项目分层
- iOS开发零碎笔记
- iOS开发常用的第三方类库
- iOS开发官方文档
- iOS常见错误之exc_bad_access 野指针错误
- iOS开发多线程
- iOS成长之AutoLayout写控件的注意事项
- ios测试基础七:常用软件
- iOS多线程中的dispatch_semaphore_t
- iOS 开发笔记
- IOS-添加分段控件SegmentControl
- 2016最新iOS开发者证书申请及安装教程