Skip to content

Instantly share code, notes, and snippets.

@ryanabel03
Created August 15, 2013 00:41
Show Gist options
  • Save ryanabel03/6237247 to your computer and use it in GitHub Desktop.
Save ryanabel03/6237247 to your computer and use it in GitHub Desktop.
class LoginViewController < UIViewController
include Objection::Compose
#motion-objection for dependency injection!
compose_with :login_table_view_model
def viewDidLoad
super
# Create our table view controller and set various properties
@table_view_controller = UITableViewController.alloc.initWithStyle UITableViewStyleGrouped
@table_view_controller.tableView.dataSource = self.login_table_view_model
@table_view_controller.tableView.delegate = self.login_table_view_model
@table_view_controller.tableView.scrollEnabled = false
@table_view_controller.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine
#Create our scroll view and add it to our view as a subview
scroll_view = UIScrollView.alloc.initWithFrame [[0, 0], [@table_view_controller.tableView.frame.size.width, @table_view_controller.tableView.frame.size.height]]
self.view.addSubview scroll_view
#Center the table view and add it as a subview of the scroll view
@table_view_controller.tableView.frame = [[(scroll_view.frame.size.width / 2) - 100, (scroll_view.frame.size.height / 2) - 200], [200, 400]]
scroll_view.addSubview @table_view_controller.tableView
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment