UIButton的resizableImageWithCapInsets使用解析--拉伸模式,通过拉伸UIEdgeInsets指定的矩形区域来填充图片
2016-02-04 14:35
726 查看
/* UIImageResizingModeTile :平铺模式,通过重复显示UIEdgeInsets指定的矩形区域来填充图片 */ UIButton *button1 = [[UIButton alloc] initWithFrame:CGRectMake(65, 250, 202, 29)]; UIImage *norImage1 = [UIImage imageNamed:@"normal"]; norImage1 = [norImage1 resizableImageWithCapInsets:UIEdgeInsetsMake(2, 2, 2, 2) resizingMode:UIImageResizingModeTile]; [button1 setBackgroundImage:norImage1 forState:UIControlStateNormal]; [self.view addSubview:button1]; /* UIImageResizingModeStretch :拉伸模式,通过拉伸UIEdgeInsets指定的矩形区域来填充图片 */ UIButton *button2 = [[UIButton alloc] initWithFrame:CGRectMake(65, 300, 202, 29)]; UIImage *norImage2 = [UIImage imageNamed:@"normal"]; norImage2 = [norImage2 resizableImageWithCapInsets:UIEdgeInsetsMake(2, 2, 2, 2) resizingMode:UIImageResizingModeStretch]; [button2 setBackgroundImage:norImage2 forState:UIControlStateNormal]; [self.view addSubview:button2]; }
相关文章推荐
- 基于IBM Bluemix的数据缓存应用实例
- iOS三种让UILabel中的text居上的方式
- 自定义WheelView UI 实现Ios滚轮效果
- fragment 用法小结
- iOS开发小记:运用Runtime机制扩大UIButton的响应区域
- iOS7中UIView的animateKeyframesWithDuration方法讲解
- 不自定义也可更改UITableViewCellSection背景颜色字体颜色
- 用UITextView加载rtfd文件
- 【Android】3.7 UI控制功能
- unsigned , NSInteger/NSUInter ,NSNumber,
- UITableView练习三之Static Cells
- hdoj4000Fruit Ninja【树状数组】
- UITableView上的UITextField防止被键盘遮挡
- Groupon面经:Find paths in a binary tree summing to a target value
- druid监控没有数据
- UItexfile实时验证输入字符
- Hbuilder MUI 选择器(Picker)设置默认选项
- UI设计 电商运营 薪资很高。
- UI基础学习之(十四):手势
- UITableView的headerView展开缩放动画