[英]Resize cells when rotating UITableView
我的桌面视图只占据了我视图的底部三分之一。
我使用CGAffineTransform将其旋转90度并调整大小:
[UIView beginAnimations:@"rotate" context:nil];
CGRect oldFrame = self.table.frame;
CGPoint oldCentre = self.table.center;
// Swap the width and height
self.table.frame = CGRectMake(0.0, 0.0, oldFrame.size.height, oldFrame.size.width);
self.table.transform = transform;
self.table.center = oldCentre;
[UIView commitAnimations];
[self.table reloadData];
因此,它从短而胖的纵向视图变为高大瘦弱的景观视图。 又回来了。
我的手机文字有中心对齐方式。 从高大瘦弱的视角回到短而肥胖的观点是行不通的。 细胞第一次调整大小,但保持调整大小!
你如何让细胞正确调整大小?
我做了一些阅读并意识到我的错误。 使用边界而不是框架。
CGRect oldBounds = self.table.bounds;
这似乎运作良好。
这应该为你调整大小,我不认为这是你想要的,但也许它会让你接近
-(CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 180; //180=pixel size
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.