-
-
Save twe4ked/5324733 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ViewController | |
include TableSection | |
def numberOfSectionsInTableView(tableView) | |
2 | |
end | |
def numberOfRowsInSection0(tableView) | |
@data.count | |
end | |
def numberOfRowsInSection1(tableView) | |
@notifications.count | |
end | |
def tableView(tableView, cellForRowAtSection0: row) | |
# Do the stuff for this row in section 0 | |
# return the cell | |
end | |
def tableView(tableView, cellForRowAtSection1: row) | |
# Do the stuff for this row in section 1 | |
# return the cell | |
end | |
def titleForHeaderInSection1(tableView) | |
'Configure Notifications' | |
end | |
end | |
module TableSection | |
def tableView(tableView, numberOfRowsInSection: section) | |
selector = "numberOfRowsInSection#{section}:" | |
if respondsToSelector(selector) | |
send(selector, tableView) | |
end | |
end | |
def tableView(tableView, cellForRowAtIndexPath: indexPath) | |
selector = "tableView:cellForRowAtSection#{indexPath.section}:" | |
if respondsToSelector(selector) | |
send(selector, tableView, indexPath.row) | |
end | |
end | |
def tableView(tableView, titleForHeaderInSection: section) | |
selector = "titleForHeaderInSection#{section}:" | |
if respondsToSelector(selector) | |
send(selector, tableView) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment