Giter Club home page Giter Club logo

Comments (2)

colinta avatar colinta commented on August 29, 2024

I think I was able to get this working:

tableview

(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 tableView(tableView, willDisplayCell:cell, forRowAtIndexPath:indexPath). If you need to define that method yourself, you can call super there.

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

from teacup.

sxross avatar sxross commented on August 29, 2024

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" [email protected] wrote:

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 tableView(tableView, willDisplayCell:cell, forRowAtIndexPath:indexPath). If you need to define that method yourself, you can call super there.

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/tableview

β€”
Reply to this email directly or view it on GitHub.

from teacup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.