Skip to content
Newer
Older
100644 30 lines (23 sloc) 835 Bytes
5fd9e6f initial commit
Richard Owens authored May 10, 2012
1 class ListViewController < UITableViewController
2 attr_accessor :delegate
3
4 def viewDidLoad
5 @links = ['http://www.rubymotion.com/', 'http://www.github.com/', 'rubymotion.com', 'google.com']
6 end
7
8 def shouldAutorotateToInterfaceOrientation(*)
9 true
10 end
f1c3afa fixed typo in numberOfSectionsInTableView method
Richard Owens authored May 11, 2012
11
12 def numberOfSectionsInTableView(tableView)
5fd9e6f initial commit
Richard Owens authored May 10, 2012
13 1
14 end
15
16 def tableView(tableView, numberOfRowsInSection:section)
17 @links.length
18 end
19
20 def tableView(tableView, cellForRowAtIndexPath:path)
21 cell = tableView.dequeueReusableCellWithIdentifier("cell") || UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier:"cell")
22 cell.textLabel.text = @links[path.row]
23 cell
24 end
25
26 def tableView(tableView, didSelectRowAtIndexPath:path)
27 @delegate.openURL(@links[path.row]) if @delegate.respond_to?'openURL'
28 end
29
30 end
Something went wrong with that request. Please try again.