0
這是我的代碼的一部分。當我嘗試加載包括uitableview的視圖時,我的應用程序崩潰。 我認爲我嘗試使用但沒有找到它的表有問題。 幫助,請宣佈的.hiPhone的SDK - 的UITableView - 不能在表分配表視圖
gameTimingTable=[NSArray arrayWithObjects:@"2min + 10sec/coup",@"1min + 15sec/coup",@"5min",nil];
爲NSArray *gameTimingTable;
這是我使用表中分配給UITableView的
- (void)viewDidLoad {
gameTimingTable=[NSArray arrayWithObjects:@"2min + 10sec/coup",@"1min + 15sec/coup",@"5min",nil];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// There is only one section.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of time zone names.
return [gameTimingTable count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
// Try to retrieve from the table view a now-unused cell with the given identifier.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
// If no cell is available, create a new one using the given identifier.
if (cell == nil) {
// Use the default cell style.
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
}
// Set up the cell.
NSString *cadence = [gameTimingTable objectAtIndex:indexPath.row];
cell.textLabel.text = cadence;
return cell;
}
/*
To conform to Human Interface Guildelines, since selecting a row would have no effect (such as navigation), make sure that rows cannot be selected.
*/
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
return nil;
}
非常感謝
任何想法? ....................... thanx – kossibox 2009-10-08 13:52:17