English 中文(简体)
旋转后未返回正确的框架
原标题:convertRect fromView not returning correct frame after rotation

I have a problem I ve run into with the UIView method convertRect: fromView: method. Here is the situation: I have an overwritten the UIView class to create a view that rotates with the user s movement(very similar to the TaskRabbit spinner). To create the rotation, over I added an additional view to my subclassed view, and I rotated that view. The rotated view contains additional subviews that obviously rotate with the rotated subview. The problem is, after the subview has been rotated, I need to find where those additional subviews are, with respect to the original overritten view - not the rotated view. To do this, in my UIView class, I have the following:

[self convertRect:currentView.frame fromView:rotationView];

然而,当我打印转换的矩形框架时, 坐标并不准确 。 有没有人碰到了 < code> conversect: fromView: 在视图旋转后不准确的问题?

< 强力 > 编辑 < /强 >

具体地说,关于这些要点不准确,我甚至看不到什么应该是什么和什么应该是什么之间的关系,用一个特定的角度,X/y翻转了等等。例如,应该在(25,195)的点在(325.25.25,273.16)处返回(325.25.25,273.16)。

最佳回答

我假设你正在通过对视图应用变换(对视图应用 < code> CGAffinde Transform 或对图层应用 CA Transformat3D ) 来旋转你的观点。 这就是造成你框架问题的原因。 < a href=> 的文档 http://developer.apple.com/library/ios/documentation/uikit/ reference/uiview_cle/uiview/uview.html#/apple_ref/oc/instp/UIView/frame" rel="nofol" UIUIView框架 说:

如果 transform 属性不是身份变换,则该属性的价值未定义,因此应当忽略。

正如您已经看到的那样,框架的值尚未定义。 您仍然可以使用 < code> center 和 < code> bounds 属性。

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签