0
! [이미지 설명을 여기에 입력하십시오] [1] 버튼을 누른 부분을 표시하고 싶습니다. 현재 섹션 시간에 시간을 표시하고 싶습니다. 한 셀이 표시됩니다 섹션이 표시됩니다. 버튼이 동시에 눌린 날짜, 섹션 제목은 2를 원하지 않습니다. 먼저 정적 TableView를 만들었습니다. 여러 사이트를 읽는 동안이 목적, 동적 TableView를 만들려고했습니다. 코드가 주석 처리되었습니다. 코드 샘플을 알려주십시오.동적 테이블보기를 만드는 방법
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
//return [array count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSString *title = @"section";
return title;
//return [array objectAtIndex:section];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (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];
}
cell.textLabel.text = [NSString stringWithFormat:@"%@ %i", @"row", indexPath.row];
return cell;
}
-(void)addButton
{
NSDate *date = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
NSString *strTime = [[NSString alloc] initWithFormat:@"%@",[formatter stringFromDate:date]];
array = [[NSMutableArray alloc] initWithCapacity:0];
[array addObject:strTime];
[array count];
}
죄송합니다. 이미 자정이기 때문에 대답이 느릴 수 있습니다. – onion
죄송합니다. 그러나 당신의 질문은별로 잘 쓰여져 있지 않습니다. 당신이 알고 싶은 것을 이해하는 것은 어렵습니다. 게다가 자정이라면 미국에 살지 않는 것 같아 영어 실력이 좋지 않을 수도 있습니다. 어느 쪽이든, 나는 당신의 질문을보다 명확하고 간결하게 다시 쓰도록 제안 할 것입니다. – Josiah
사진이 도움이 될 수있는 간단한 와이어 프레임을 그릴 수 있다면 그림이 천 단어를 말합니다. – Imran