-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParentViewController.m
executable file
·45 lines (35 loc) · 1.38 KB
/
ParentViewController.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
#import "ParentViewController.h"
#import "UIDevice+Resolutions.h"
#import "MenuViewController.h"
@interface ParentViewController ()
@end
@implementation ParentViewController
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
-(void)viewWillLayoutSubviews{
[super viewWillLayoutSubviews];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
self.view.clipsToBounds = YES;
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenHeight = 0.0;
if(UIDeviceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
screenHeight = screenRect.size.height;
else
screenHeight = screenRect.size.width;
CGRect screenFrame = CGRectMake(0, 20, self.view.frame.size.width,screenHeight-20);
CGRect viewFrame1 = [self.view convertRect:self.view.frame toView:nil];
if (!CGRectEqualToRect(screenFrame, viewFrame1)) {
self.view.frame = screenFrame;
self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}
}
}
-(BOOL)isiOS7{
return [[[UIDevice currentDevice] systemVersion] floatValue] >= 7?YES:NO;
}
-(BOOL)isForIphone4{
UIDevice *currentDevice = [UIDevice currentDevice];
return [currentDevice resolution] == UIDeviceResolution_iPhoneRetina4?YES:NO;
}
@end