UIView框架设置错误,查看得到{nan,nan}起源。

时间:2011-09-23 08:07:46

标签: ios uiview uikit

这是我的代码的一部分。

NSLog(@"fr: %@", NSStringFromCGRect(frame_)); NSLog(@"org: %@",
NSStringFromCGPoint(frame_.origin)); //    cell.frame = frame_; [cell
setFrame: frame_];

NSLog(@"c: %@", cell); NSLog(@"c frame: %@",
NSStringFromCGRect(cell.frame));

打印输出令人惊讶。有人对此有任何想法吗?帮助和谢谢。

[657:707] fr: {{350, 600}, {175, 300}}
[657:707] org: {350, 600}
[657:707] c: <JXUIGridViewCell: 0xf62d3c0; frame = (nan nan; 175 300); tag = 4010; animations = { position=<CABasicAnimation: 0x15b4a0>; bounds=<CABasicAnimation: 0x15b540>; }; layer = <CALayer: 0xf62d400>>
[657:707] c frame: {{nan, nan}, {175, 300}}

1 个答案:

答案 0 :(得分:2)

我实际上也在寻找这个问题的答案。但是很快就出现了。 但事实证明,如果你在任何时候将视图的原点设置为nan,那么它将会坚持下去。因此它永远不会再被改变。 解决方案:切勿将视图原点设置为nan。