当前位置: 首页>>代码示例>>Java>>正文


Java UIView.convertPointFromView方法代码示例

本文整理汇总了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);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:19,代码来源:ViewAssertsTest.java

示例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);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:22,代码来源:ViewAssertsTest.java

示例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);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:19,代码来源:ViewAssertsTest.java

示例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);
}
 
开发者ID:liraz,项目名称:robolayout,代码行数:22,代码来源:ViewAssertsTest.java


注:本文中的org.robovm.apple.uikit.UIView.convertPointFromView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。