hackers-painters / samurai-native

Bring web standards to native platform
http://hackers-painters.github.io/samurai-native/
MIT License
2.28k stars 382 forks source link

uibutton不能够设置文字颜色 #17

Closed Jichao closed 9 years ago

Jichao commented 9 years ago

文字颜色一直为白色,使用css并不能够更改,从catalog uibutton的运行结果可以看出. ios simulator screen shot 2015 5 9 3 57 07 原因是UIButton+Html.m当中处理button颜色的时候,使用了titleLabel.textColor,但是ios的document明确指出

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.

因此要改成[self setTitleColor:[style computeColor:self.titleLabel.textColor] forState:UIControlStateNormal];就正确了。

ios simulator screen shot 2015 5 9 4 01 27

enrecul commented 9 years ago

Thanks!