How to set background image of a view?

后端 未结 7 1276
梦如初夏
梦如初夏 2020-12-04 16:35

I am a beginner at Obj-C/Cocoa Touch/iPhone OS.

I wish to have a background for my app with different images everytime the the view is called.

Say I have 10

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 17:32

    It's a very bad idea to directly display any text on an irregular and ever changing background. No matter what you do, some of the time the text will be hard to read.

    The best design would be to have the labels on a constant background with the images changing behind that.

    You can set the labels background color from clear to white and set the from alpha to 50.0 you get a nice translucent effect. The only problem is that the label's background is a stark rectangle.

    To get a label with a background with rounded corners you can use a button with user interaction disabled but the user might mistake that for a button.

    The best method would be to create image of the label background you want and then put that in an imageview and put the label with the default transparent background onto of that.

    Plain UIViews do not have an image background. Instead, you should make a UIImageView your main view and then rotate the images though its image property. If you set the UIImageView's mode to "Scale to fit" it will scale any image to fit the bounds of the view.

提交回复
热议问题