Looking for a way to implement a "full-screen" action reversible with double tap but I did not succeed!
More in detail, there are 2 UIView : - topViewContainer - bottomViewContainer
When I double-tap on the superview, the view "bottomViewContainer" extends to full-screen, and I re-double tap, the view returns to its original size.
It should work in portrait mode and Landscape Mode!
This is what I've done until now:
-(void)handleDoubleTap:(UITapGestureRecognizer *)sender {
if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight) {
if (sender.numberOfTapsRequired == 2){
NSLog(@"if gesture up - LS");
[UIView animateWithDuration:0.5
delay:0.1
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
topContainerView.frame = CGRectMake(0.0, -160.0, 480.0, 244.0);
bottomContainerView.frame = CGRectMake(0.0, 0.0, 480.0, 300.0);}
completion:^(BOOL finished){
NSLog(@"%f,%f",bottomContainerView.frame.size.width,bottomContainerView.frame.size.height);
}];
} else if (sender.numberOfTapsRequired == 2) {
NSLog(@"else if gesture down - LS");
[UIView animateWithDuration:0.5
delay:0.1
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
topContainerView.frame = CGRectMake(0.0, -160.0, 480.0, 244.0);
bottomContainerView.frame = CGRectMake(0.0, 84.0, 480.0, 216.0);}
completion:^(BOOL finished){
NSLog(@"%f,%f",bottomContainerView.frame.size.width,bottomContainerView.frame.size.height);
}];
}
}
else if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait) {
if (sender.numberOfTapsRequired == 2) {
NSLog(@"if gesture down - PT");
[UIView animateWithDuration:0.5
delay:0.1
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
topContainerView.frame = CGRectMake(0.0, 0.0, 320.0, 244.0);
bottomContainerView.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 640.0);
}
completion:^(BOOL finished){
NSLog(@"%f,%f",bottomContainerView.frame.size.width,bottomContainerView.frame.size.height);
}];
}
else if (sender.numberOfTapsRequired == 2) {
NSLog(@"else if gesture up - PT");
[UIView animateWithDuration:0.5
delay:0.1
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
topContainerView.frame = CGRectMake(0.0, 0.0, 320.0, 244.0);
bottomContainerView.frame = CGRectMake(0.0, 244.0, self.view.frame.size.width, 216.0);
}
completion:^(BOOL finished){
NSLog(@"%f,%f",bottomContainerView.frame.size.width,bottomContainerView.frame.size.height);
}];
}
}
}