i have a class with no .xib file, and i want to set the background with a UIImageView with a .png file i have in the resources, i try this:
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
[[self view] setBackgroundColor:background];
[background release];
this work, but the image is zoomed in and loses a lot of quality, instead in another class with xib file i set a UIImageView in background by Interface Builder and the image is perfetct, i wanna know how i can set the UIImageView in background as i do in interface builder.
Sorry if i forgot to write that my class is a UITableViewController, this is the solution:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[imageView setImage:[UIImage imageNamed:@"background.png"]];
self.tableView.backgroundView = imageView;
[imageView release];
thanks to all!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With