JRG-Developer / AutoLayoutCells

AutoLayoutCells makes working with dynamic table view cells easy.
MIT License
26 stars 4 forks source link

Adding UIAccessoryView to cell cuts off label text. #10

Closed AnthonyMDev closed 9 years ago

AnthonyMDev commented 9 years ago

When a UIAccessoryView is added to a cell, the labels text gets cut off if there is a large amount of text in the cell.

It looks like the ALLabel's height is being calculated before the accessory view is set up, and since the width changes when the accessory view is added, the label's height is wrong.

Any ideas on how we can make the label take the accessory view into account?

JRG-Developer commented 9 years ago

By UIAccessoryView do you actually mean the accessoryView property on UITableViewCell?

If so, the table view cells in AutoLayoutCells weren't designed or tested to work with an accessoryView.

To make it work, I imagine you have two options:

(1) Cheat -- subclass ALBaseCell or ALCell and use a custom accessory view instead to do whatever you're trying to do.

(2) Redesign stuff -- not sure if it's even possible, but you could see if you can get it to work with accessoryView set and change height calculations as necessary? I imagine this is the harder of the two options.

Let me know which you go with. When you come up with a working prototype, let me know too, and I'd be happy to take a look.

:]

AnthonyMDev commented 9 years ago

I think I actually did find a way to make AutoLayoutCells support the use of accessoryViews!

I'm working on it right now and I'll probably be putting in a pull request today or tomorrow.

JRG-Developer commented 9 years ago

Awesome, I look forward to seeing it!

AnthonyMDev commented 9 years ago

Pull request made - #11

JRG-Developer commented 9 years ago

:+1:

This looks promising. I'll try to take a look at this later and see if it's possible to clean it up a bit more.

Thanks, Anthony!

:]

AnthonyMDev commented 9 years ago

It seems that there are too many different factors that go into this calculation. My original pull request #11 was not sufficient. I've been trying to find a good way to calculate this, but I'm not sure if it's possible. Putting this on hold now and closing this issue. For now I'm just going to use the cheat you've suggested.