Closed luosheng closed 12 years ago
This issue would be much more valuable as a pull request with the changed code, considering you have identified the problem and also suggested changes.
Could you submit a pull request with the changes?
OK, I'll do that.
The following code is supposed to create a black button with a red title on it. However it only shows a black rectangle without any text.
It's because the ivar
_titleView
is only initialized when propertytitleLabel
is accessed in TUIButton.m. But indrawRect:
, text values and colors are assigned to a non-initialized ivar_titleView
, and[_titleView drawRect:_titleView.bounds]
doesn't work as expected since_titleView
is nil.Please change
_titleView
toself.titleLabel
indrawRect:
, or at least the first occurrence of_titleView
.