jamonholmgren / ProMotion

ProMotion is a RubyMotion gem that makes iPhone development less like Objective-C and more like Ruby.
MIT License
1.26k stars 147 forks source link

TableScreen's title_view doesn't work with rmq/redpotion #770

Open markrickert opened 8 years ago

markrickert commented 8 years ago

I ran into an issue where when setting a title_view: on a table section would actually set the RMQ stylesheet I had set on the screen to nil, causing all sorts of problems for the cells underneath.

I fixed this in my project by doing this in table.rb.

# Section header view methods
def tableView(_, viewForHeaderInSection: index)
  section = promotion_table_data.section(index)
  view = section[:title_view]
  view = section[:title_view].new if section[:title_view].respond_to?(:new)

  # Added the line below to fix the issue...
  view.stylesheet = self.stylesheet if self.stylesheet && view.respond_to?(:stylesheet=)

  view.on_load if view.respond_to?(:on_load)
  view.title = section[:title] if view.respond_to?(:title=)
  view
end

Not sure if we should add this to redpotion or what...

jamonholmgren commented 8 years ago

Odd. Yeah, we should probably add this to RedPotion.