UITableViewCell

Discussion in 'iOS Development' started by NolesFans, Jan 16, 2009.

  1. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    Code:
    - (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView {
        return 2;
    }
    
    // Customize the number of rows in the table view.
    - (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
    	if (section == 0) {
    		return 1;
    	}
        return [fansGroup count];
    }
    
    // Customize the appearance of table view cells.
    - (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
        static NSString *CellIdentifier = @"FansCell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
        }
    	// Set up the cell...
    	NSDictionary *fansForNow = [fansGroup objectAtIndex:indexPath.row];
    	if ([fansForNow objectForKey:kClassKey]) {
    		cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    	}
    	cell.text = [fansForNow objectForKey:kTitleKey];
        return cell;
    }
    I am seeing 2 same cells in Section 0 Row 1 and Section 1 Row 1. Is there to hide Section 1 Row 1 cells? I should have to do NSMutableArray per section.

Share This Page