IOS 4.2
create project and select "Split View-based Application"
define the array in RootViewController.h file:
init the array in viewDidLoad method
implementation method:
---------------------------------------
Solution: insert follow code after init the array a:
thx admanimal.
create project and select "Split View-based Application"
define the array in RootViewController.h file:
Code:
NSMutableArray *a;
Code:
a = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",nil];
implementation method:
Code:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath{
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil){
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
}
if(indexPath.row < [a count]){
cell.textLabel.text = [a objectAtIndex:indexPath.row];
}
return cell;
}
---------------------------------------
Solution: insert follow code after init the array a:
Code:
[a retain];
thx admanimal.
Last edited: