-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table accessoryView Doesn't Work with UITextField, UITextView #69
Comments
Are you sure the bug isn't perhaps just with UITextField's sizeThatFits: implementation? UILabel, etc. are all UIView subclasses as well. On Oct 7, 2011, at 1:33 PM, shannona wrote:
|
UILabel has its own sizeThatFits: method, which is why it works. UITextField (and UITextView, which I also tested), just drop back to UIView's default method. Whether the problem is the UIView method (return size;), that UITextField and UITextView don't have their own method, or that layoutSubviews does the wrong thing, I don't actually know--just that the behavior is different under iOS. |
Ok. Likely the real problem is that UITextView/UITextField don't have a sizeThatFits: implementation. Investigation will be necessary. On Oct 7, 2011, at 2:40 PM, shannona wrote:
|
When I thought about it more, that's what made the most sense to me too. |
The accessoryView in tables is limited to UILabels and other classes that respond meaningfully to sizeThatFits: . If you instead try to use a UIView child, such as UITextField, the accessory ends up writing right over the main label because sizeThatFits: in UIView just returns the size that it's given.
It's the layoutSubviews method in UITableViewCell that does the wrong thing.
(Under iOS, a UIView in an accessoryView instead behaves as expected.)
The text was updated successfully, but these errors were encountered: