Objective-C 框架
为什么这是一个糟糕的任务?
AbstractionView.frame.origin.y = 空FrameView.frame.origin.y;
编译器抱怨...需要左值作为赋值的左操作数
Why is this a bad assignment?
abstractionView.frame.origin.y = emptyFrameView.frame.origin.y;
The compiler complains... lvalue required as left operand of assignment
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从来没有完全清楚为什么直接分配给 CGRect 结构的成员不起作用(除了需要知道任何 成员值何时发生变化的更高级别的问题之外) CGRect 用于定位渲染元素),但解决此问题的方法是执行如下操作:
我知道,这有点痛苦。也许其他人可以更好地解释为什么这是必要的。
It's never been entirely clear to me why direct assignment to members of a
CGRect
structure doesn't work (apart from higher-level concerns with respect to needing to know when a member value changes for anyCGRect
that is being used to position a rendered element), but the way to work around this is to do something like the following:It's kind of a pain, I know. Maybe someone else can offer a better explanation about why this is necessary in the first place.