Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-15-2010, 04:04 PM   #1 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 2
connecties is on a distinguished road
Default Noob: Setting background image

Hi,

I'm a noob to iPhone development so my question might be of questionable difficulty.

I want to create an app with an image as a background.
I want it to load at startup so I guess the code needs to go in viewDidLoad?

And then....... beats me.

Can someone lead me in the proper direction?

Kind regards,
Werner
connecties is offline   Reply With Quote
Old 10-15-2010, 04:13 PM   #2 (permalink)
Banned
 
Join Date: Jul 2009
Posts: 576
Not_Appy_At_All is on a distinguished road
Default

Quote:
Originally Posted by connecties View Post
Hi,

I'm a noob to iPhone development so my question might be of questionable difficulty.

I want to create an app with an image as a background.
I want it to load at startup so I guess the code needs to go in viewDidLoad?

And then....... beats me.

Can someone lead me in the proper direction?

Kind regards,
Werner
Try this in viewDidLoad...

Code:
    UIImage *yourImage = [UIImage imageNamed:@"yourImageName.png"];
    UIImageView* yourImageView = [[UIImageView alloc]initWithImage:yourImage];
    yourImageView.frame = CGRectMake(0, 0, 320, 460);
    [self.view addSubview:yourImageView];
    [yourImageView release];
Be sure to drag in the image..."yourImageName.png" into your resources folder.

You can also use IB...Interface Builder and avoid coding it.

Last edited by Not_Appy_At_All; 10-15-2010 at 04:16 PM.
Not_Appy_At_All is offline   Reply With Quote
Old 10-15-2010, 04:18 PM   #3 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 386
SoulRed12 is on a distinguished road
Default

While NAaA's code will work, my advice to you, connecties, would be to watch the iPhone Development Stanford podcasts. Just open iTunes, go to the iTunes store, seach for "iPhone Development", and click on the iTunes U result that is from Stanford. They are extremely helpful and will be much better for you in the long run than just copying someone else's code, because it will help you understand why the code works, and then you can modify it or recreate it later on your own if you need to. It's much better & faster to be able to understand the code so you can write it yourself than to have to search online for code to do what you want.

Good luck!
__________________
HEY! Was this post helpful?
If so, it would be MUCH appreciated if you'd just click on one of these apps:



MyD
Take 1 minute to set up your MyD and you'll always be able to prove you own your device!

Membrik
Test your memory by sliding tiles to match chains of increasing difficulty.

©2011 Dardom Productions | Like us on Facebook!
SoulRed12 is offline   Reply With Quote
Old 10-15-2010, 04:38 PM   #4 (permalink)
Banned
 
Join Date: Jul 2009
Posts: 576
Not_Appy_At_All is on a distinguished road
Default

Quote:
Originally Posted by SoulRed12 View Post
While NAaA's code will work, my advice to you, connecties, would be to watch the iPhone Development Stanford podcasts. Just open iTunes, go to the iTunes store, seach for "iPhone Development", and click on the iTunes U result that is from Stanford. They are extremely helpful and will be much better for you in the long run than just copying someone else's code, because it will help you understand why the code works, and then you can modify it or recreate it later on your own if you need to. It's much better & faster to be able to understand the code so you can write it yourself than to have to search online for code to do what you want.

Good luck!
Yes...

Give a man a fish, and he will eat for a day, teach him to fish...and you know the rest of that.
Not_Appy_At_All is offline   Reply With Quote
Old 10-15-2010, 04:49 PM   #5 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 2
connecties is on a distinguished road
Default

Quote:
Originally Posted by SoulRed12 View Post
While NAaA's code will work, my advice to you, connecties, would be to watch the iPhone Development Stanford podcasts. Just open iTunes, go to the iTunes store, seach for "iPhone Development", and click on the iTunes U result that is from Stanford. They are extremely helpful and will be much better for you in the long run than just copying someone else's code, because it will help you understand why the code works, and then you can modify it or recreate it later on your own if you need to. It's much better & faster to be able to understand the code so you can write it yourself than to have to search online for code to do what you want.

Good luck!
You are so right.
Only thing is that going over the complete course takes me a lot of time.
As a seasoned and old school developer I want to get my hands dirty ;-)
(doing java for 10 years by now).

I do have the complete course downloaded on my mac and have seen the first view lessons. But as said I also want to do something. And what better way than to ask you.

Thanks for your reply.
connecties is offline   Reply With Quote
Old 10-15-2010, 08:00 PM   #6 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 386
SoulRed12 is on a distinguished road
Default

If you already understand the basics, and can understand why NAaA's code works, then...well just using NAaA's code is fine, it's like giving someone who already knows how a car works the tools he needs to fix it. I wasn't trying to say that you have to discover everything for yourself; my only point is, (using the car example) if I went up to someone and just showed them exactly what to do without explaining it and told them to just do the same exact thing, they wouldn't be able to do it again next time and/or wouldn't be able to fix a related problem if it became necessary.
__________________
HEY! Was this post helpful?
If so, it would be MUCH appreciated if you'd just click on one of these apps:



MyD
Take 1 minute to set up your MyD and you'll always be able to prove you own your device!

Membrik
Test your memory by sliding tiles to match chains of increasing difficulty.

©2011 Dardom Productions | Like us on Facebook!
SoulRed12 is offline   Reply With Quote
Reply

Bookmarks

Tags
background, image, noob

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 342
8 members and 334 guests
Desert Diva, dre, hain, HemiMG, mottdog, oceanlablight, schmallegory
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:08 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0