How can I create a UIView with a watermarked UIImageView behind?

I'm not sure if watermark is the correct term here, but I want to do the following.

I want to display a UIViewController (there is also a UITabBar on the screen). I'm going to look at this UIViewController. I want the whole ViewController to display the image. Then I want to overlay a colored caption over this image, say 80% alpha (transparency). So you see the image faintly in the background.

Then I want to add some UILabel, UITextField and other UIImageView.

I have a few questions.

1) What size picture do I need? This app is for portrait only. I noticed that Apple HIG claims the iPhone 6+ screen size is 1242 x 2208. Does that mean that I need my designer to present me with a 1242x2208 image to create this UIViewController that I want? What about the UITabBar and the status bar that are on the screen. Will they be able to shrink and distort the image?

2) If I get the image in "iPhone 6+" size, please reduce its size for other models? 6, 5, 4s? Or do I just create a UIImageView, hold it back from all sides, and then tell it to respect the aspect ratio?

3) Do I need this image in 4 sizes, specifically for 4, 5, 6 and 6+. Or am I just getting a big image and letting it scale? Does it even need to be 1242x2208?

3a) Could there be more?

3b) Should I avoid less so it never scales (and looks weird)?

3c) Should my image need to be created in a 9:16 ratio like 1242x2208?

+3


source to share


2 answers


1) you may only need one (1242 x 2208) if you set the image content mode to aspect fill

; but if the image is BAD CUTTING system, you need 4 different image sizes (for example, iPhone5 can be 640 * (1136-tabHeight-statusbar));



2) you are better off using a different size image for a different device, because you can get MemoryWarning

on iPhone4s if you use a large image.

+1


source


Your designer can make an image that includes a full size color overlay, and if it uses a limited color palette, the file size will be fairly small and not a memory issue. If you don't need precise image positioning across all screen sizes, one image will work. Use the contentMode aspectFill and the aspect ratio will be preserved. Redundant image will be turned off. Place the UIImageView at the bottom of the view hierarchy and use constraints to snap to edges (as you said.)



Ask your designer to create an image in png8 file format. This will be good enough for low contrast images and still has full resolution for large screen sizes. The fill aspect will scale the image so that it doesn't distort.

0


source







All Articles