【问题标题】:offset a image view from another imageview?从另一个图像视图偏移图像视图?
【发布时间】:2009-06-13 11:41:02
【问题描述】:

我正在尝试将 imageviews 原点设置为从另一个 imaeviews 原点偏移,但我没有运气。图像的左侧或右侧居中并稍微向上。

这是我的代码。

imageView1.center = CGPointMake(imageView2.center.x + 20, imageView2.center.y + 35);

【问题讨论】:

  • 看起来不错。你能发布两张图片和你的窗口截图吗?
  • 所发生的只是图像视图保持在另一个图像视图的中心

标签: iphone


【解决方案1】:

可能更容易处理起源...

    kOffset = 5;

    kWidth = 50

    kHeight = 50;

    CGRect frame = CGRectMake(0,0, kWidth, kHeight);

    UIImageView *theImage;


for(int i = 0; i<numberOfImages; i++){ 


    theImage = [[UIImageView alloc] initWithFrame:frame];

    frame.origin.x += (kWidth + kOffset);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多