Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIView background pattern

Can I achieve the same as a following:

view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"imageName.png"]];

using IB only? Without need to write such a codeline? It seems that IB only allows to set up plain color, not images as background.

like image 410
Nick Avatar asked Apr 24 '11 00:04

Nick


2 Answers

Interface Builder doesn't allow the use of a background pattern. However you could simply overlay the background with the appropriate image within an UIImageView. This would give the desired look to the application, without having to use the code you posted above.

However, I strongly disagree that you should use only Interface Builder. Code is a lot cleaner in my eyes and allows for a lot more control over what you build.

like image 52
Sebastien Peek Avatar answered Oct 17 '22 10:10

Sebastien Peek


This cannot be done in IB, but got the code right. Despite what others have commented, use IB to the fullest extent possible, that way you can focus your efforts on the real business logic of your application, only customizing further where IB doesn't reach. Good luck!

like image 2
Wayne Hartman Avatar answered Oct 17 '22 08:10

Wayne Hartman