我的自定义 TableViewCell 在 Storyboard中定义了一个 imageView,框架为(195, 16; 95,25)
但是当我尝试在运行时访问框架时,它会为所有导出返回 (0, 58, 0, 0),不仅仅是 imageView,还有 UILabels。
//CustomTableViewCell subclass
- (void)layoutSubviews{
[super layoutSubviews];
NSLog(@"%@", self.fiveStartForeground);
}
这来自控制台:
2012-09-27 18:57:46.563 200Pomodoros[11395:c07] <UIImageView: 0x7599640; frame = (0 58; 0 0); clipsToBounds = YES; opaque = NO; autoresize = TM+BM; layer = <CALayer: 0x759a0d0>>
但过了一会儿,又恢复正常了:
2012-09-27 18:58:48.025 200Pomodoros[11395:c07] <UIImageView: 0x7599640; frame = (195.5 16; 94.5 25); clipsToBounds = YES; opaque = NO; autoresize = TM+BM; layer = <CALayer: 0x759a0d0>>
我需要更改图像框架(宽度)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
所以它看起来像是一个 5 星评级的东西。 但我得到的帧是错误的。(0, 58, 0, 0)...
最佳答案
这是 iOS6 的愚蠢的自动布局...禁用它,你就可以开始了。
关于iphone - 自定义TableViewCell imageView框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12619827/