iOS一些细节坑点

本文介绍如何正确地为UIButton设置文字颜色,并指出使用titleLabel属性的误区;同时讲解了如何确保应用程序支持iPhone 5及更高版本设备的屏幕尺寸。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.不要用titlelabel来设置textcolor,要用setTitleColor方法


官方原话:

Do not use the label object to set the text color or the shadow color. Instead, use the setTitleColor:forState: and setTitleShadowColor:forState: methods of this class to make those changes.

The titleLabel property returns a value even if the button has not been displayed yet. The value of the property is nil for system buttons.

2.  [UIScreen mainScreen].bounds获取屏幕大小时在iPhone5上应该有一张 Default-568h@2x.png以证明你的应用支持IPhone5否则无法获取到iPhone5的屏幕大小


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值