repeat image in iOs

最后都变了- 提交于 2019-12-08 11:24:08

问题


I have an image which is 1*90 with gradient and i want to use it as background for different height say for example for first row of height 90 then no issues but second one is 100 then third is of 80... hw do I do this?


回答1:


try + [UIColor colorWithPatternImage:]




回答2:


self.someImage = [[UIImage imageNamed:@"yourImage.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 10, 0)];

that will resize image and keep 10 pixels at top, 0 at left, 10 at bottom and 0 at right. You can also try

self.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage.png"]] autorelease];
self.backgroundView.contentMode = UIViewContentModeScaleToFill;

Hope it helps



来源:https://stackoverflow.com/questions/8533721/repeat-image-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!