Skip to content
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

Open
shannona opened this issue Oct 7, 2011 · 4 comments
Open

Table accessoryView Doesn't Work with UITextField, UITextView #69

shannona opened this issue Oct 7, 2011 · 4 comments

Comments

@shannona
Copy link

shannona commented Oct 7, 2011

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.)

@BigZaphod
Copy link
Owner

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:

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.)

Reply to this email directly or view it on GitHub:
#69

@shannona
Copy link
Author

shannona commented Oct 7, 2011

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.

@BigZaphod
Copy link
Owner

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:

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, 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.

Reply to this email directly or view it on GitHub:
#69 (comment)

@shannona
Copy link
Author

shannona commented Oct 7, 2011

When I thought about it more, that's what made the most sense to me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants