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 04-17-2008, 05:02 PM   #1 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 21
Posts: 84
Nitrex88 is an unknown quantity at this point
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default Help with Image View

Hey, even after having my question answered in another forum I still can't figure out how to implement image view with interface builder. I can assign a picture to an image view and build successfully but the image never appears in the simulator, its just my default white view. I have tried everything with adding subviews and generating different class files for the image view and can't get it to work. If someone could please post a sample of the .h and .m files to get an image view to appear with a visible image or just post a quick sample project I would very much appreciate it. Sorry for being such a noob. Again, thanks for the help
Nitrex88 is offline   Reply With Quote
Old 04-17-2008, 05:40 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Location: Lexington, KY
Posts: 108
Fastrak is an unknown quantity at this point
Default Re: Help with Image View

>>> even after having my question answered in another forum

What is the link to the other answer?
Fastrak is offline   Reply With Quote
Old 04-17-2008, 08:17 PM   #3 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 21
Posts: 84
Nitrex88 is an unknown quantity at this point
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default Re: Help with Image View

Here is the link to the other forum i got an answer. This allowed me to assign an image to the image view but i still couldnt see it when the application launched.

http://forum.insanelymac.com/index.php?showtopic=99114

Hope you can help. Thanks
Nitrex88 is offline   Reply With Quote
Old 04-18-2008, 12:57 AM   #4 (permalink)
New Member
 
Join Date: Apr 2008
Location: Onomatopoeia, Lugubriousylvania
Posts: 225
bonehead is an unknown quantity at this point
Default Re: Help with Image View

Something like this has worked for me:

(from inside your UIViewController loadView)

UIImage* myImage = [UIImage imageNamed:@"fancy_picture.png"];
float newImgHeight = myImage.size.height;

CGRect myViewFrame = CGRectMake(
mViewBounds.origin.x,
mNextViewYOffset,
mViewBounds.size.width,
newImgHeight
);

UIImageView imageView = [[UIImageView alloc] initWithFrame: myViewFrame];
[imageView setImage: myImage];
[self.view addSubview: imageView];
[imageView release];

This assumes that the "fancy_picture.png" file has been added to you XCode project already....
bonehead is offline   Reply With Quote
Old 04-19-2008, 12:02 AM   #5 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 21
Posts: 84
Nitrex88 is an unknown quantity at this point
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default Re: Help with Image View

Quote:
Originally Posted by bonehead
Something like this has worked for me:

(from inside your UIViewController loadView)

UIImage* myImage = [UIImage imageNamed:@"fancy_picture.png"];
float newImgHeight = myImage.size.height;

CGRect myViewFrame = CGRectMake(
mViewBounds.origin.x,
mNextViewYOffset,
mViewBounds.size.width,
newImgHeight
);

UIImageView imageView = [[UIImageView alloc] initWithFrame: myViewFrame];
[imageView setImage: myImage];
[self.view addSubview: imageView];
[imageView release];

This assumes that the "fancy_picture.png" file has been added to you XCode project already....
Alright, i tried to do what you told me but im not very good at this Objective-C yet. Here is a test project of what I thought you meant but it just returns a lot of errors.

http://www.megaupload.com/?d=TZKITPDC

See if maybe you could fix up the code to make it work, or just make a new one. All I want for the test is to be able to make the button picture appear when i run the program. If you don't have time for this then its ok. Thanks for all the help. Hopefully one day ill be able to figure this out myself.
Nitrex88 is offline   Reply With Quote
Reply

Bookmarks

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tinting an image? moopf iPhone SDK Development 2 01-28-2009 03:56 AM
display image from xml sangau001 iPhone SDK Development 2 06-15-2008 02:09 PM
Navigation Bar Image gholland iPhone SDK Development 1 06-07-2008 09:54 PM
Image for navigation bar. Kristos iPhone SDK Development 2 05-27-2008 09:39 AM
UIButton with an image ddavtian iPhone SDK Development 1 04-30-2008 02:53 PM


» Advertisements
» Online Users: 382
7 members and 375 guests
apatsufas, JackReidy, jeroenkeij, Sami Gh, tim0504, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

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