ios开发_UIButton的常见设置

76次阅读
一条评论

– (void)setTitle:(NSString *)title forState:(UIControlState)state;
设置按钮的文字

– (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;
设置按钮的文字颜色

– (void)setImage:(UIImage *)image forState:(UIControlState)state;
设置按钮内部的小图片

– (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;
设置按钮的背景图片
设置按钮的文字字体(需要拿到按钮内部的label来设置)
btn.titleLabel.font = [UIFont systemFontOfSize:13];

– (NSString *)titleForState:(UIControlState)state;
获得按钮的文字

– (UIColor *)titleColorForState:(UIControlState)state;
获得按钮的文字颜色

– (UIImage *)imageForState:(UIControlState)state;
获得按钮内部的小图片

– (UIImage *)backgroundImageForState:(UIControlState)state;
获得按钮的背景图片

正文完
 0
评论(一条评论)
2019-08-24 01:56:22 回复

文章不错支持一下吧

     美国德克萨斯休斯顿