그래서 iOS 용 응용 프로그램을 구축 중이며 많은 것들을 계산하여 화면에 표시하려면 -(IBAction)calculate
으로 가져 왔습니다. 또한 잘라내 목록이 될 증분 배열을 만듭니다. 보기의 한쪽 아래로 공백 인 UITableView
이 있습니다. 나는 viewDidLoad
후에 그것을 가지고있다. 이제 계산 버튼을 누르면이 목록에 증가하는 절단 목록이 채워집니다. 나는 이것에 저를 도울 어떤 자습서 또는 등을 발견 할 수 없다.버튼 터치에서 UITableView를 채우는 방법
계산 작업에 넣을 때만 오류가 발생합니다. 그래서 나는 viewDidLoad
다음에 남겨두고 버튼 터치에서 그것을 채우기를 바랐다.
// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [creeperArray count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
[cell.textLabel setText:[creeperArray objectAtIndex:indexPath.row]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
*/
}
감사합니다. –