-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathIPhonePopoverHandler.m
56 lines (42 loc) · 2.01 KB
/
IPhonePopoverHandler.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// IPhonePopoverHandler.m
// iGenomics
//
// Created by Stuckinaboot Inc. on 3/29/14.
//
//
#import "IPhonePopoverHandler.h"
@implementation IPhonePopoverHandler
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
return self;
}
- (void)viewWillAppear:(BOOL)animated {
// modifiableView.frame = CGRectMake(0, navBar.frame.size.height, modifiableView.frame.size.width, modifiableView.frame.size.height);
// mainController.view.frame = CGRectMake(0, 0, modifiableView.frame.size.width, modifiableView.frame.size.height);
navBar.topItem.title = navBarTitle;
[modifiableView addSubview:mainController.view];;
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTapOccurred:)];
recognizer.numberOfTapsRequired = kIPhonePopoverMinTapsRequired;
[modifiableView addGestureRecognizer:recognizer];
}
- (void)viewDidLayoutSubviews {
if (([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft) ||
([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight)) {
modifiableView.frame = CGRectMake(self.view.safeAreaLayoutGuide.layoutFrame.origin.x, navBar.frame.size.height, modifiableView.frame.size.width, self.view.safeAreaLayoutGuide.layoutFrame.size.height - navBar.frame.size.height);
mainController.view.frame = CGRectMake(0, 0, modifiableView.frame.size.width, modifiableView.frame.size.height);
}
// [modifiableView layoutSubviews];
}
- (void)setMainViewController:(UIViewController *)controller andTitle:(NSString *)title {
mainController = controller;
navBarTitle = title;
}
- (IBAction)doubleTapOccurred:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return mainController.supportedInterfaceOrientations;
}
@end