0
난 내 표에 표시하려면 다음 항목이아이폰 테이블 뷰
redFlowers = [[NSMutableArray alloc] init];
[redFlowers addObject:@"red"];
이이 배열
#define sectionCount 2
#define redSection 0
#define blueSection 1
@synthesize tableFavoritesData, tableView, favoritesArray, redFlowers;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return sectionCount;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
switch (section) {
case redSection:
return [redFlowers count];
case blueSection:
return [tableFavoritesData count];
}
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
switch (section) {
case redSection:
return @"Refresh";
case blueSection:
return @"Favorites";
}
}
// 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] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
switch (indexPath.section)
{
case redSection:
cell.textLabel.text =[redFlowers objectAtIndex:indexPath.row];
case blueSection:
cell.textLabel.text = [tableFavoritesData objectAtIndex: indexPath.row];
}
return cell;
내가로드
을 표시하도록되어 방법입니다 내 테이블은 redFlowers 배열의 모든 "빨간 셀"에 표시되지 않지만 그 섹션 안에 tableFavoritesdata의 테이블을 표시합니다.
대단히 감사합니다. –