Last active
January 1, 2016 14:59
-
-
Save naderhen/8161526 to your computer and use it in GitHub Desktop.
SideMenuController.rb
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 SideMenuController < UIViewController | |
attr_accessor :domains | |
def loadView | |
super | |
end | |
def viewDidLoad | |
super | |
self.title = "SideMenu" | |
self.view.styleId = "side-menu" | |
self.view.backgroundColor = UIColor.whiteColor | |
self.domains = [] | |
@table = UITableView.alloc.initWithFrame(CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height)) | |
self.view.addSubview @table | |
@table.dataSource = self | |
@table.delegate = self | |
refresh | |
end | |
def refresh | |
load_domains | |
end | |
def load_domains | |
@domains = ["domain1.org", "domain2.com"] | |
@table.reloadData | |
end | |
def tableView(tableView, numberofSectionsinTableView: tableView) | |
self.domains.length | |
end | |
def tableView(tableView, numberOfRowsInSection: section) | |
1 | |
end | |
def tableView(tableView, cellForRowAtIndexPath: indexPath) | |
@reuseIdentifier ||= "CELL_IDENTIFIER" | |
cell = tableView.dequeueReusableCellWithIdentifier(@reuseIdentifier) | |
cell = UITableViewCell.alloc.initWithStyle( | |
UITableViewCellStyleDefault, | |
reuseIdentifier: @reuseIdentifier) | |
cell.textLabel.text = "View Users" | |
cell | |
end | |
def tableView(tableView, titleForHeaderInSection:section) | |
self.domains[section] | |
end | |
def tableView(tableView, didSelectRowAtIndexPath:indexPath) | |
ap "Selected Something" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment