I'm new to objective C and I can't seem to set the correct UIView in a tableViewCell when rotating BACK to portrait after first rotating to landscape.
I checked several related posts, but nothing seems to solves my problem. When I print the width I get the expected results although the output is incorrect.
I created a UIView "lineView" to add custom lines between the cells in my tableView (this was necessary due to some seperator problems in different sections).
Here's part of the code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"anIdentifier" forIndexPath:indexPath];
... Content of the cell
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(10, 42,tableView.bounds.size.width-20, 0.7);
lineView.backgroundColor = [UIColor blackColor];
[cell.contentView addSubview:lineView];
return cell;
}
When I run my whole program I get the following outpus (from left to right: no rotation, rotate to landscape, rotate back to portrait):
The seperator lines in figure 1 and 2 are correct, but when I rotate back to landscape the right inset dissapears. There probably is a trivial solution but my primitive skills are letting me down.
What am I missing?