1

每次按下同一段后,我的表格视图控制器都会从视图中向下推,大约一个单元格的大小。任何人有想法为什么会发生?其他不包含任何表视图的视图工作正常。这是它的样子在此处输入图像描述

编辑:评论中的代码:

- (void)indexDidChangeForSegmentedControl:(UISegmentedControl *)aSegmentedControl {
    NSUInteger index = aSegmentedControl.selectedSegmentIndex;
    UIViewController * incomingViewController = [self.viewControllers objectAtIndex:index];
    NSArray * theViewControllers = [NSArray arrayWithObject:incomingViewController];
    [self.navigationController setViewControllers:theViewControllers animated:NO];
    incomingViewController.navigationItem.titleView = aSegmentedControl;
}

- (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath {
    cell.backgroundColor = indexPath.row % 2 ? [UIColor colorWithRed:216.0f/255.0f green:235.0f/255.0f blue:213.0f/255.0f alpha:1.0f] : [UIColor colorWithRed:178.0f/255.0f green:107.0f/255.0f blue:146.0f/255.0f alpha:1.0f];
    cell.textLabel.font = [UIFont fontWithName:@"CaviarDreams" size:23];
    cell.textLabel.textColor = indexPath.row % 2 ?[UIColor colorWithRed:178.0f/255.0f green:107.0f/255.0f blue:146.0f/255.0f alpha:1.0f] :[UIColor colorWithRed:216.0f/255.0f green:235.0f/255.0f blue:213.0f/255.0f alpha:1.0f];
    cell.textLabel.backgroundColor = [UIColor clearColor];
    cell.detailTextLabel.backgroundColor = [UIColor clearColor];
}
4

0 回答 0