-
Notifications
You must be signed in to change notification settings - Fork 85
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
Constraint-based custom cells somehow don't work. #87
Comments
I think I was able to get this working: (on iOS7, so there's that silly status bar) Here's how I did it: diff --git a/app/app_delegate.rb b/app/app_delegate.rb
index 36ec472..11d77f6 100644
--- a/app/app_delegate.rb
+++ b/app/app_delegate.rb
@@ -36,9 +36,15 @@ class TableViewController < UITableViewController
cell.attendees_label = subview(UILabel, :cell_attendees_label, :text => "attendees #{indexPath.row}")
end
end
- cell.contentView.apply_constraints
+
cell
end
+
+ def tableView(tableView, willDisplayCell:cell, forRowAtIndexPath:indexPath)
+ cell.restyle!
+ cell.apply_constraints
+ end
+
end
class CustomCell < UITableViewCell Unfortunately, this requires a change to the delegate, not something I can inject automatically. But you win some you lose some. My thinking is that this could be integrated easily: class TableViewController < UITableViewController
module Teacup::TableViewDelegate
# ...
end Would define class TableViewController < UITableViewController
module Teacup::TableViewDelegate
def tableView(tableView, willDisplayCell:cell, forRowAtIndexPath:indexPath)
super
# stuff
end
# ...
end This is working in this branch: https://github.com/rubymotion/teacup/tree/tablecell |
Thanks for tracking this down. I've been up to my eyes in a Rails project for one of my best clients and MotionModel is really getting a lot of uptake and hence feature requests, issues, etc. which take time. Maybe I can get back to my iOS app one day :) Steve On Jun 28, 2013, at 8:40 AM, "Colin T.A. Gray" notifications@github.com wrote:
|
Either that, or I'm not getting how they're supposed to work. Here's a small extracted project that illustrates the problem. There should be 3 labels per cell, stacked vertically inside a small padding view. Nothing specified in the
layout
blocks seems to have a rectangle with non-zero size.https://github.com/sxross/constraint_based_table_cell
The text was updated successfully, but these errors were encountered: