iOS开发中UIButton的setImage和setBackgroundImage用法区别
2016-04-16 10:27
706 查看
- (void)setImage:(nullable
UIImage *)image forState:(UIControlState)state;
// default is nil. should be same size if different for different states
该方法不会拉伸图片,保持图片的原始比例显示在Button中。如果继续设置title属性则无法显示。
- (void)setBackgroundImage:(nullable
UIImage *)image forState:(UIControlState)state
UI_APPEARANCE_SELECTOR;
// default is nil
该方法会拉伸图片,平铺在Button中,不会影响继续在Button中设置title等属性。
UIImage *)image forState:(UIControlState)state;
// default is nil. should be same size if different for different states
该方法不会拉伸图片,保持图片的原始比例显示在Button中。如果继续设置title属性则无法显示。
- (void)setBackgroundImage:(nullable
UIImage *)image forState:(UIControlState)state
UI_APPEARANCE_SELECTOR;
// default is nil
该方法会拉伸图片,平铺在Button中,不会影响继续在Button中设置title等属性。
相关文章推荐
- LeetCode 232. Implement Queue using Stacks
- SCVMM 2012 SP1 – QuickStart deployment guide
- ZOJ 3932 Deque and Balls
- ZOJ 3932 Deque and Balls
- 软件也要拼脸蛋,UI开发的点点滴滴
- UI - 视图控制器跳转另一个视图控制器特效总结
- 【iOS开发-91】GCD的同步异步串行并行、NSOperation和NSOperationQueue一级用dispatch_once实现单例
- (LeetCode 303) Range Sum Query - Immutable
- LeetCode 300. Longest Increasing Subsequence
- HBuilder写的第一个表单文件
- Druid 配置
- UI-UIScrollView
- UI-不常用控件 UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
- poj 1239 Increasing Sequences dp lis
- UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController
- UIAlertViewDelegate 的使用简介
- (LeetCode 191) Number of 1 Bits
- iOS 为UILabel添加长按复制功能
- ConcurrentQueue对列的基本使用方式
- uva 11572 Unique Snowflakes