简体   繁体   English

用XCode表示照片的“堆栈”

[英]Represent 'stack' of photos with XCode

I'm trying to make a larger representation of the image like the one next to 'Camera Roll' where it shows the user that there are multiple images. 我正在尝试以更大的图像表示形式,例如“相机胶卷”旁边的图像,该图像向用户显示有多个图像。

In the 'old' days you would probably have tried to show it like a stack of polaroid images however that isn't really the cool thing to do now. 在过去,您可能会尝试将其显示为一堆宝丽来图像,但是现在这并不是一件很酷的事情。

I've taken a look around and can't think of anything and can't see any 3rd party libraries. 我环顾四周,什么也没想,也看不到任何第三方库。

Any help would be appreciated :) 任何帮助,将不胜感激 :)

相机胶卷

You would do this by simply by creating UIImageViews, altering them a bit, and then adding them to the superview. 您只需创建UIImageViews,对其进行一些更改,然后将其添加到Superview中,即可完成此操作。 Here is an example with images called "0", "1", and "2". 这是一个名为“ 0”,“ 1”和“ 2”的图像的示例。

    let buffer = 10
    for idx in 0...2 {
        let newImageView = UIImageView(frame: CGRectMake(self.view.frame.minX + self.view.frame.width/4 - CGFloat(idx*buffer/4), self.view.frame.minY + self.view.frame.height/4 + CGFloat(idx*buffer/2), 100 + CGFloat(idx*buffer/2), 100 + CGFloat(idx*buffer/2)))
        newImageView.clipsToBounds = true
        newImageView.contentMode = .ScaleAspectFill
        newImageView.layer.borderColor = UIColor.whiteColor().CGColor
        newImageView.layer.borderWidth = 1
        newImageView.image = UIImage(named: idx.description)
        self.view.addSubview(newImageView)
        }
    }

I hope this can help you with your design! 希望这对您的设计有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM