octover / lexikon
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (3)
- Wiki (1)
- Graphs
-
Tree:
843fb66
commit 843fb66036afdea8981c7ede625aae4b44ff9551
tree 09e00ebcba988ba99c295e0caa9c9218f6d4fcf5
parent 99ae845836eb73a35e3af66cb10cc11633b351cc
tree 09e00ebcba988ba99c295e0caa9c9218f6d4fcf5
parent 99ae845836eb73a35e3af66cb10cc11633b351cc
lexikon / SearchSuggestionsController.m
| f4dd5f76 » | octover | 2009-02-11 | 1 | // | |
| 2 | // SearchSuggestionsController.m | ||||
| 3 | // Lexikon | ||||
| 4 | // | ||||
| 5 | // Created by Caleb Jaffa on 2/8/09. | ||||
| 6 | // Copyright 2008-2009 Caleb Jaffa, MIT licensed | ||||
| 7 | // | ||||
| 8 | |||||
| 9 | #import "SearchSuggestionsController.h" | ||||
| 10 | #import "Word.h" | ||||
| 11 | #import "MainViewController.h" | ||||
| 12 | |||||
| 13 | @implementation SearchSuggestionsController | ||||
| 14 | |||||
| e658df9f » | octover | 2009-02-12 | 15 | @synthesize tableView, suggestions, main; | |
| f4dd5f76 » | octover | 2009-02-11 | 16 | ||
| 17 | - (void)didReceiveMemoryWarning { | ||||
| 18 | [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview | ||||
| 19 | // Release anything that's not essential, such as cached data | ||||
| 20 | } | ||||
| 21 | |||||
| 22 | #pragma mark Table view methods | ||||
| 23 | |||||
| 24 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | ||||
| 25 | return 1; | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | // Customize the number of rows in the table view. | ||||
| 29 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||||
| 30 | return [suggestions count]; | ||||
| 31 | } | ||||
| 32 | |||||
| 33 | // Customize the appearance of table view cells. | ||||
| 34 | - (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||||
| 35 | |||||
| 36 | static NSString *CellIdentifier = @"Cell"; | ||||
| 37 | |||||
| 38 | UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; | ||||
| 39 | if (cell == nil) { | ||||
| 40 | cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; | ||||
| 41 | } | ||||
| 42 | |||||
| 43 | cell.text = [[suggestions objectAtIndex:indexPath.row] word]; | ||||
| 44 | |||||
| 45 | // Set up the cell... | ||||
| 46 | |||||
| 47 | return cell; | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||||
| 51 | [main viewWord:[suggestions objectAtIndex:indexPath.row]]; | ||||
| 52 | [tableView deselectRowAtIndexPath:indexPath animated:NO]; | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | - (void)dealloc { | ||||
| e658df9f » | octover | 2009-02-12 | 56 | [main release]; | |
| 57 | [suggestions release]; | ||||
| 58 | [tableView release]; | ||||
| 59 | [super dealloc]; | ||||
| f4dd5f76 » | octover | 2009-02-11 | 60 | } | |
| 61 | |||||
| 62 | |||||
| 63 | @end | ||||
| 64 | |||||

