I have an XIB file with UIControl and UIScrollView elements inside it. I would like to add a background image to the view. I tried to add ImageView to IB, but I could not get it to be present as a background, and it hid the controls. Sending a sendViewBack message sendViewBack nothing either.
When I create the UIImageView program code, it is not displayed.
Below is the code I tried:
Software Creation
UIImage *imageBackground = [UIImage imageWithContentsOfFile:@"globalbackground"]; UIImageView *backgroundView = [[UIImageView alloc] initWithImage:imageBackground]; [[self view] addSubview:backgroundView]; [[self view] sendSubviewToBack:backgroundView];
Work with the NIB file
[[self view] sendSubviewToBack:background];
where background is an IBOutlet declared in the header file and connected to the IB NIB image view.
Is there any step I'm missing here?
source share