iPhone Developer Help

Full Version: Dev Tip: Default.png
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Finally starting to get it...

here's a tip:

if you put Default.png in an images directory for your application bundle it will display that image when the application loads.

I miss .NET Compact Framework :-(

Felix
I'm actually trying right now to figure out how to set an image as a background, I can see how it was done in the apple sample code programs but I built my interface in IB, so I am not sure... Does anyone know what might be the best option?
I'd stay away from using ib. Ib is still buggy and I'd wait until the non beta release. Anyway you can display a background image by using uiimageview. Just make a cgrect to be the size of the screen and assign an image to your uiimageview. Its really easy. Look at the uiimageview doc for more detail.

rbenjamin Wrote:
I'm actually trying right now to figure out how to set an image as a background, I can see how it was done in the apple sample code programs but I built my interface in IB, so I am not sure... Does anyone know what might be the best option?


CGRect screenRect = [[UIScreen mainScreen] bounds]; // Set up the window and content view
self.window = [[[UIWindow alloc] initWithFrame:screenRect] autorelease];
UIImageView *myImageView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; //Add the image as the background view
myImageView.image = [UIImage imageNamed:@"Default.png"];
[anImageView release];
[self.window addSubview: self.anImageView];
[self.window makeKeyAndVisible]; // Show the window



This code may help You...


felixk Wrote:
I'd stay away from using ib. Ib is still buggy and I'd wait until the non beta release. Anyway you can display a background image by using uiimageview. Just make a cgrect to be the size of the screen and assign an image to your uiimageview. Its really easy. Look at the uiimageview doc for more detail.

rbenjamin Wrote:
I'm actually trying right now to figure out how to set an image as a background, I can see how it was done in the apple sample code programs but I built my interface in IB, so I am not sure... Does anyone know what might be the best option?


Reference URL's