Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 1, 2009, 12:42 AM   #1
iAppleFan08
macrumors newbie
 
Join Date: Aug 2008
picture hidden help

This is another one of my simple little problems in learning how to code in Objective-C, but this time I need to hide a picture. I have a picture that, when I press a button, I want it to hide. Then, with another button, I want the picture to come back again. Creating an IBOutlet and pointing to the picture refused to work, so I was wondering if there was any particular way I was supposed to go about this...
iAppleFan08 is offline   0 Reply With Quote
Old Apr 1, 2009, 12:55 AM   #2
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Connect the first UIButton's touchUpInside event to an IBAction that hides the image. Connect the second UIButton's event to an IBAction that shows the image. Connect the image to an IBOutlet. Code goes something like this:

Code:
- (IBAction)hideImage {
    theImage.hidden = YES;
}

- (IBAction)showImage {
    theImage.hidden = NO;
}
__________________
dejo is online now   0 Reply With Quote
Old Apr 1, 2009, 01:00 AM   #3
iphonedevelop18
macrumors member
 
Join Date: Feb 2009
the way i did it was make a clear image with no background and set the image view to it. use the code
Code:
-(IBAction)hide:(id)sender{
    imageView.image = [UIImage imagenamed:@"clearimage.png"]
}
imageView is your view that you connected in IB, and make your clear image you made called clearimage.png and put it anywhere in your project. To make it come back use the same code but set the image to whatever yoour image was named.

Hope this helps!
iphonedevelop18 is offline   0 Reply With Quote
Old Apr 1, 2009, 01:01 AM   #4
yuanyuan
macrumors newbie
 
Join Date: Apr 2009
Quote:
Originally Posted by iphonedevelop18 View Post
the way i did it was make a clear image with no background and set the image view to it. use the code
Code:
-(IBAction)hide:(id)sender{
    imageView.image = [UIImage imagenamed:@"clearimage.png"]
}
imageView is your view that you connected in IB, and make your clear image you made called clearimage.png and put it anywhere in your project. To make it come back use the same code but set the image to whatever yoour image was named.

Hope this helps!
I don't think there is any book for iPhone development that assumes its readers are total beginners. They assume some knowledge of Objective-C. Therefore, start with an Objective-C book and then progress to an iPhone development book.
yuanyuan is offline   0 Reply With Quote
Old Apr 1, 2009, 01:11 AM   #5
CocoaPuffs
macrumors 68010
 
Join Date: Aug 2008
Oh, this guy is a spammer!
CocoaPuffs is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Hidden Object Mansion: Victoria Vane The Picture Of Curse iPadNick iPhone and iPod touch Apps 2 Jun 30, 2014 04:41 PM
OS X: Star Wars Empire at War - Picture-in-picture GFX Glitch swwack91 Mac and PC Games 7 May 15, 2014 07:04 AM
iMovie 'picture in picture' image size question shuffles Mac Basics and Help 6 Jan 18, 2013 11:48 AM
hidden files on my HDD are to stay hidden forever???help falconb Mac Basics and Help 11 Oct 11, 2012 02:30 PM
How to make multiple Picture-In-Picture with iMovie VinegarTasters Digital Video 7 Sep 2, 2012 11:33 PM

Forum Jump

All times are GMT -5. The time now is 11:02 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC