【问题标题】:How to increase the size of a imageView upon touching it如何在触摸时增加 imageView 的大小
【发布时间】:2011-02-11 15:44:29
【问题描述】:

我有一个图像视图,用户可以触摸和拖动它,以便他可以将其放置在另一个地方。当用户触摸(或拖动)图像时,我想增加 imageView(或突出显示)的大小。反正我能做到吗???谢谢你

【问题讨论】:

    标签: iphone ipad uiimageview


    【解决方案1】:

    在您想要增加尺寸的方法中,请执行以下操作:

    CGRect newFrame = theImgView.frame;
    newFrame.size.width += increaseInWidth;
    newFrame.size.height += increaseInHeight;
    theImgView.frame = newFrame;
    

    请注意,如果您希望图像变得更大,而不仅仅是图像视图的框架,图像视图的 contentMode 应该是“缩放填充”或“纵横比填充”:)

    可以通过在 ImageView 顶部放置一个半透明的 UIView(不透明 = NO;alpha = 0.5)来完成突出显示。

    【讨论】:

    • 感谢 Bogatyr 的回复。我会试试这个,让你知道输出......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-12
    • 1970-01-01
    • 2018-01-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多