Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding A Background Image In Interface Builder

I'm trying to add a custom image as a background for my application using Xcode 4.2, but I'm not too sure how to do it. I can add plain colors as the background in Interface Builder, but I do not see the option to add a custom image. I have Googled this issue and have researched it for hours, but none of the solutions have seemed to work for me and are out of date. I've read Apple's documentation, but it went over my head. I'm still a beginner when it comes to programming. Does anyone know of a simple way to set my custom image as the background for the UIView?

Thank you.

like image 656
Henry F Avatar asked Jan 01 '12 19:01

Henry F


2 Answers

Use a UIImageView that is the size of your views frame.

like image 104
Mark Adams Avatar answered Nov 15 '22 06:11

Mark Adams


You could also use this Statement in Code.

    [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"foo.bar"]]];
like image 15
Dennis Stritzke Avatar answered Nov 15 '22 07:11

Dennis Stritzke