开发者

Obj-C, how to handle a background image which is squashed on some views and not others?

开发者 https://www.devze.com 2023-02-17 02:04 出处:网络
I\'ve got a background image with a radial gradient, on some views it looks fine. But on others where I have extra controls at the top of the view its squashed as it has less room to be show.

I've got a background image with a radial gradient, on some views it looks fine.

But on others where I have extra controls at the top of the view its squashed as it has less room to be show.

I guess I'm going to have to t开发者_开发百科ake account of the where the images starts at the top or the bottom, so one end will loose a section. But if I can do this via a property, rather than stretch ? or if I have to chop the image some how ?

What can I do?


Are you showing with UIImageView? Default contentmode is set to UIViewContentModeScaleToFill, which is to stretch in all directions to fit frame.

Change contentMode property to get the effect you want, ie UIViewContentModeScaleAspectFill.

0

精彩评论

暂无评论...
验证码 换一张
取 消