Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- // Return the number of sections.
- return 2;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- // Return the number of rows in the section.
- int count;
- switch (section) {
- case 0:
- count = [_objectArray count];
- break;
- case 1:
- NSLog(@"section called"); // This line is logged
- count = 1;
- default:
- count = 0;
- break;
- }
- return count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *CellIdentifier = @"myCellIdentifier";
- static NSString *basicCellIdentifier = @"myBasicCellIdentifier";
- switch ([indexPath section]) {
- case 0: {
- TableViewStoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier
- forIndexPath:indexPath];
- // Configure the cell...
- int theIndex = [indexPath row];
- MyObject *theObj = [_objectArray objectAtIndex:theIndex];
- cell.object = theObj;
- return cell;
- break;
- }
- case 1: {
- NSLog(@"cell called"); //this line isn't logged
- for (int i = 0; i < 50; i++) {
- NSLog(@"hahaha");
- }
- MyBasicViewStoryCell *cell = [tableView dequeueReusableCellWithIdentifier:basicCellIdentifier forIndexPath:indexPath];
- return cell;
- break;
- }
- default: {
- for (int i = 0; i < 50; i++) {
- NSLog(@"hahaha1");
- }
- return nil;
- break;
- }
- }
- }
- case 1:
- NSLog(@"section called"); // This line is logged
- count = 1;
- break; // always put break!
- switch (section) {
- case 0:
- count = [_objectArray count];
- break;
- case 1:
- NSLog(@"section called"); // This line is logged
- count = 1;
- break; // Here
- default:
- count = 0;
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement