0

I added a view (displayTapeView)to the superview via Storyboard and it's working fine. But when I want to remove displayTapeView when clicking the "Back"button on the displayTapeView. It doesn't work. My current code is as below:

- (IBAction)tapeButtonPressed:(id)sender {
self.displayTapeView.hidden=NO;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
//[[self displayTapeView] removeFromSuperview];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.displayTapeView cache:YES];
self.displayTapeView.layer.masksToBounds=NO;
self.displayTapeView.layer.shadowOffset=CGSizeMake(-15.0,20.0);
self.displayTapeView.layer.shadowRadius=5.0;
self.displayTapeView.layer.shadowOpacity=0.5;
//[[self view] addSubview:_displayTapeView];
[UIView commitAnimations];
}

- (IBAction)backButtonPressed:(id)sender {
[[self displayTapeView] removeFromSuperview];

}

What I want to do is when "Back" button is clicked, the displayTapeView is removed and the superview is shown.

Thank you in advance!

lei he
  • 259
  • 3
  • 8
  • try hiding the view instead of removing it. Your purpose will be solved with this I guess. – z22 Feb 21 '15 at 07:45

1 Answers1

0
self.displayTapeView.hidden = YES;
ravron
  • 11,014
  • 2
  • 39
  • 66