本文整理汇总了Java中org.robovm.apple.uikit.UIView.convertPointFromView方法的典型用法代码示例。如果您正苦于以下问题:Java UIView.convertPointFromView方法的具体用法?Java UIView.convertPointFromView怎么用?Java UIView.convertPointFromView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robovm.apple.uikit.UIView
的用法示例。
在下文中一共展示了UIView.convertPointFromView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertViewIsLeftAlignedToView
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* Assert that two views are left aligned, that is that their left edges
* are on the same x location.
*
* @param first The first view
* @param second The second view
*/
protected void assertViewIsLeftAlignedToView(UIView first, UIView second) {
UIView commonAncestor = findMostCommonAncestorOfView(first, second);
if(commonAncestor == null) {
Assert.fail("Views can't be aligned because they don't have a common ancestor");
}
CGPoint origin1 = commonAncestor.convertPointFromView(first.getFrame().getOrigin(), first);
CGPoint origin2 = commonAncestor.convertPointFromView(second.getFrame().getOrigin(), second);
Assert.assertEquals("views are not left aligned", origin1.getX(), origin2.getX(), 0);
}
示例2: assertViewIsRightAlignedToView
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* Assert that two views are right aligned, that is that their right edges
* are on the same x location.
*
* @param first The first view
* @param second The second view
*/
protected void assertViewIsRightAlignedToView(UIView first, UIView second) {
UIView commonAncestor = findMostCommonAncestorOfView(first, second);
if(commonAncestor == null) {
Assert.fail("Views can't be aligned because they don't have a common ancestor");
}
CGPoint origin1 = commonAncestor.convertPointFromView(first.getFrame().getOrigin(), first);
CGPoint origin2 = commonAncestor.convertPointFromView(second.getFrame().getOrigin(), second);
CGSize firstMeasuredSize = UIViewLayoutUtil.getMeasuredSize(first);
CGSize secondMeasuredSize = UIViewLayoutUtil.getMeasuredSize(second);
Assert.assertEquals("views are not right aligned", origin1.getX() + firstMeasuredSize.getWidth(), origin2.getX() + secondMeasuredSize.getWidth(), 0);
}
示例3: assertViewIsTopAlignedToView
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* Assert that two views are top aligned, that is that their top edges
* are on the same y location.
*
* @param first The first view
* @param second The second view
*/
protected void assertViewIsTopAlignedToView(UIView first, UIView second) {
UIView commonAncestor = findMostCommonAncestorOfView(first, second);
if(commonAncestor == null) {
Assert.fail("Views can't be aligned because they don't have a common ancestor");
}
CGPoint origin1 = commonAncestor.convertPointFromView(first.getFrame().getOrigin(), first);
CGPoint origin2 = commonAncestor.convertPointFromView(second.getFrame().getOrigin(), second);
Assert.assertEquals("views are not top aligned", origin1.getY(), origin2.getY(), 0);
}
示例4: assertViewIsBottomAlignedToView
import org.robovm.apple.uikit.UIView; //导入方法依赖的package包/类
/**
* Assert that two views are bottom aligned, that is that their bottom edges
* are on the same y location.
*
* @param first The first view
* @param second The second view
*/
protected void assertViewIsBottomAlignedToView(UIView first, UIView second) {
UIView commonAncestor = findMostCommonAncestorOfView(first, second);
if(commonAncestor == null) {
Assert.fail("Views can't be aligned because they don't have a common ancestor");
}
CGPoint origin1 = commonAncestor.convertPointFromView(first.getFrame().getOrigin(), first);
CGPoint origin2 = commonAncestor.convertPointFromView(second.getFrame().getOrigin(), second);
CGSize firstMeasuredSize = UIViewLayoutUtil.getMeasuredSize(first);
CGSize secondMeasuredSize = UIViewLayoutUtil.getMeasuredSize(second);
Assert.assertEquals("views are not bottom aligned", origin1.getY() + firstMeasuredSize.getHeight(), origin2.getY() + secondMeasuredSize.getHeight(), 0);
}