【问题标题】:UIView frame is set wrongly, view got {nan, nan} origin.UIView 框架设置错误,视图获得了 {nan, nan} 原点。
【发布时间】:2011-09-23 08:07:45
【问题描述】:

这是我的代码的一部分。

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}}

【问题讨论】:

  • 你没有说你是怎么得到frame_的。你能显示那个代码吗?
  • 我不记得如何获得frame_。但是,NSLog 打印输出可以告诉 frame_ 中的内容。对吗?
  • 你能解决这个问题吗?我目前也有同样的情况,不知道我的代码有什么问题。

标签: ios uiview uikit


【解决方案1】:

我实际上也在寻找这个问题的答案。但是来不及了。 但事实证明,如果你在任何时候将视图的原点设置为 nan,那么它就会坚持下去。因此,它永远无法再次更改。 解决方案:永远不要将视图的原点设置为 nan。

【讨论】:

    猜你喜欢
    • 2011-06-19
    • 2019-12-08
    • 1970-01-01
    • 2012-07-17
    • 2021-05-07
    • 1970-01-01
    • 2011-03-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多