ram
ram

Reputation: 13

how to remove image for iphone

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    if ([[touch view] tag] == 1000) 
    {
        tap=YES;
        NSLog(@"tap");
        //[yourButton setShowsTouchWhenHighlighted:YES];
        if(tap)
        {
            CGRect myImageRect = CGRectMake(p.x-113, p.y-113, 224.0f, 195.0f);
            myImagea = [[UIImageView alloc] initWithFrame:myImageRect];
            [myImagea setImage:[UIImage imageNamed:@"Enjoy Sunburst.png"]];
            myImagea.opaque = YES; // explicitly opaque for performance
            [self.view addSubview:myImagea];
            [myImagea release];                 
        }
        [pieMenu showInView:self.view atPoint:p]; 
}               
    else {
        NSLog(@" NO tap"); 
        // i want to remove image when user is not tapping
        //how to do that is myImagea.alpha=0 is the only options
    }
}

Upvotes: 1

Views: 233

Answers (2)

iwasrobbed
iwasrobbed

Reputation: 46703

I'm going to assume your touch events code is correct...

To actually remove the object, you'd do something similar to this

[someObjectHere removeFromSuperview];

If you're trying to hide it, do what Jacob stated via the hidden property

Upvotes: 0

Jacob Relkin
Jacob Relkin

Reputation: 163228

You can set the hidden property of the UIImageView to YES.

If you would actually want to remove it, you can call removeFromSuperview.

Upvotes: 1

Related Questions