Created
May 28, 2013 13:53
-
-
Save arkan/5662905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCustomCell < UITableViewCell | |
# This method is used by ProMotion to instantiate cells. | |
def initWithStyle(style_name, reuseIdentifier: reuseIdentifier) | |
super | |
stylish | |
self | |
end | |
# A delegate method when the user clicks the Row(it's blue by default) | |
def setHighlighted(highlighted, animated: animated) | |
if highlighted | |
self.backgroundColor = UIColor.redColor | |
else | |
self.backgroundColor = UIColor.whiteColor | |
end | |
end | |
def stylish | |
self.backgroundColor = UIColor.whiteColor | |
self.selectionStyle = UITableViewCellSelectionStyleNone | |
end | |
end | |
class MyAwesomeScreen < ProMotion::TableScreen | |
def on_init | |
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone #To remove the cell's separator | |
self.tableView.backgroundColor = UIColor.yellowColor | |
end | |
def table_data | |
[{ | |
cells: (1..100).to_a.collect {|c| | |
{ | |
title: "Cell at row #{c}", | |
cell_identifier: "MyCustomCellIdentifier", | |
cell_class: MyCustomCell, | |
height: 70, | |
} | |
} | |
}] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment