picture hidden help

Discussion in 'iOS Programming' started by iAppleFan08, Mar 31, 2009.

  1. iAppleFan08 macrumors newbie

    Aug 26, 2008
    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...
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    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:

    - (IBAction)hideImage {
        theImage.hidden = YES;
    - (IBAction)showImage {
        theImage.hidden = NO;
  3. iphonedevelop18 macrumors member

    Feb 26, 2009
    the way i did it was make a clear image with no background and set the image view to it. use the code
        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!
  4. yuanyuan macrumors newbie

    Mar 31, 2009
    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.
  5. CocoaPuffs macrumors 68010

    Aug 23, 2008

Share This Page