01.
#import "ViewController.h"
02.
03.
@interface
ViewController ()
04.
{
05.
NSMutableArray
*myObject;
06.
}
07.
08.
@end
09.
10.
@implementation
ViewController
11.
12.
13.
- (
void
)viewDidLoad
14.
{
15.
[
super
viewDidLoad];
16.
17.
18.
myObject = [[
NSMutableArray
alloc] init];
19.
20.
[myObject addObject:@
"ThaiCreate.Com 1"
];
21.
[myObject addObject:@
"ThaiCreate.Com 2"
];
22.
[myObject addObject:@
"ThaiCreate.Com 3"
];
23.
[myObject addObject:@
"ThaiCreate.Com 4"
];
24.
}
25.
26.
- (
NSInteger
)tableView:(
UITableView
*)tableView numberOfRowsInSection:(
NSInteger
)section
27.
{
28.
return
myObject.count;
29.
}
30.
31.
- (
UITableViewCell
*)tableView:(
UITableView
*)tableView cellForRowAtIndexPath:(
NSIndexPath
*)indexPath
32.
{
33.
34.
static
NSString
*CellIdentifier = @
"Cell"
;
35.
36.
UITableViewCell
*cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
37.
if
(cell ==
nil
) {
38.
39.
cell = [[[
UITableViewCell
alloc] initWithStyle :
UITableViewCellStyleSubtitle
40.
reuseIdentifier : CellIdentifier] autorelease];
41.
}
42.
43.
44.
NSString
*cellValue = [myObject objectAtIndex:indexPath.row];
45.
cell.textLabel.text = cellValue;
46.
47.
return
cell;
48.
}
49.
50.
- (
void
)didReceiveMemoryWarning
51.
{
52.
[
super
didReceiveMemoryWarning];
53.
54.
}
55.
56.
- (
void
)dealloc {
57.
[myTable release];
58.
[
super
dealloc];
59.
}
60.
@end