views:

20

answers:

1

Hello community, is there any way to hide an UIButton until the UIImageView is pressed?? When the picture is pressed I need to show the back Button, like it works at the Photo App on the iPhone??? Here is the code of my UIButton:

- (void)viewDidLoad {
    [super viewDidLoad];

    [self ladeImage];
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(10, 10, 40, 40);
    [btn addTarget:self action:@selector(goToViewA) forControlEvents:UIControlEventTouchUpInside];
    [btn setTitle:@"<<" forState:UIControlStateNormal];
    [self.view addSubview:btn];

    }
+2  A: 

First step : btn.hidden = YES

Then you have to subclass the UIImageView to react to its touchesEnded: event and change the hidden property of your button there. For that, the proper way is to create a protocol (with a viewTouched method). Implement that protocol in the viewController containing your button and you ImageView. Add a delegate propery to the subclassed ImageView (i.e. id<MyCustomProtocol> _delagate;) and assign the view controller to this propery.

P.S: And don't forget to accept answer(s) that matches your question(s) (i.e click the green V icon on the left) ;-)

VdesmedT
Ok i have solved the Problem now it works, thank you a lot and I have accept the answer too :-)
Marco
Great. Have a nice day and keep rewarding people that helps you :-)
VdesmedT
+! for And don't forget to accept answer(s) that matches your question(s) (i.e click the green V icon on the left) ;-)
Raj