I have a UITableView as a UIViewController . The viewController interface is controlled through a storyboard. The delegate and data source are set in the viewController as needed.
I have the following code:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if (updateType == Profile) { return 15; } else { return 6; } } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; }
The above two methods are called exactly as they should. A call to [self.tableview reloadData] results in repeated method calls. The incomprehensible part is that - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath never called. Someday.
The data source and delegate are set to code, where self.tableview is the IBOutlet for the UITableView in the storyboard:
self.tableview.delegate = self; self.tableview.dataSource = self;
Answer found
I use storyboards with auto layout. The problem was that the dimensions were set to wRegular hRegular, even though the rest of the storyboard was set up as WAny hAny. A simple switch made it work! Funny I know, but this is the answer nonetheless.
source share