Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

heightForRowAtIndexPath called twice in iOS 8 but one time in iOS 7

#import "ViewController.h" static NSString *itemIdentifier = @"CellIdentifier"; @interface ViewController () @property (weak, nonatomic) IBOutlet UITableView *listTableView; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self.listTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:itemIdentifier]; // self.listTableView.estimatedRowHeight = 60; // Do any additional setup after loading the view, typically from a nib. } #pragma mark - UITableViewDatasource & UITableViewDelegate - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 0; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { return nil; } - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.backgroundColor = [UIColor clearColor]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"height for row:%zd",indexPath.row); return 44; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 20; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:itemIdentifier]; cell.textLabel.text = [NSString stringWithFormat:@"row:%zd",indexPath.row]; return cell; }


here is my code ,the method heightForRowAtIndexPath called twice in iOS 8 but one time in iOS 7, why ?

MacBook Pro (13-inch Mid 2012), iOS 8.3

Posted on Jul 4, 2015 1:45 AM

Reply
1 reply

heightForRowAtIndexPath called twice in iOS 8 but one time in iOS 7

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.