public
Description: An iPhone application to query and cache results from the online Lexin Swedish-English dictionary for immigrants
Homepage:
Clone URL: git://github.com/octover/lexikon.git
Click here to lend your support to: lexikon and make a donation at www.pledgie.com !
lexikon / SearchSuggestionsController.m
100644 65 lines (46 sloc) 1.677 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// SearchSuggestionsController.m
// Lexikon
//
// Created by Caleb Jaffa on 2/8/09.
// Copyright 2008-2009 Caleb Jaffa, MIT licensed
//
 
#import "SearchSuggestionsController.h"
#import "Word.h"
#import "MainViewController.h"
 
@implementation SearchSuggestionsController
 
@synthesize tableView, suggestions, main;
 
- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
  // Release anything that's not essential, such as cached data
}
 
#pragma mark Table view methods
 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  return 1;
}
 
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [suggestions count];
}
 
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
  static NSString *CellIdentifier = @"Cell";
 
  UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
  }
  
  cell.text = [[suggestions objectAtIndex:indexPath.row] word];
    
  // Set up the cell...
 
  return cell;
}
 
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  [main viewWord:[suggestions objectAtIndex:indexPath.row]];
  [tableView deselectRowAtIndexPath:indexPath animated:NO];
}
 
- (void)dealloc {
  [main release];
  [suggestions release];
  [tableView release];
  [super dealloc];
}
 
 
@end