-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVars.m
86 lines (71 loc) · 1.58 KB
/
Vars.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// Vars.m
//
//
// Created by Mutafin Askar on 25.02.13.
// Copyright (c) 2013. All rights reserved.
//
#import "Vars.h"
#import <QuartzCore/QuartzCore.h>
@implementation Vars
/*
* This method and returns height of screen
*/
+ (float)heightOfNavbar
{
return 50.0f;
}
/*
* This method and returns width of screen
*/
+ (float)widthView
{
return UIScreen.mainScreen.bounds.size.width;
}
/*
* This method and returns height of whole screen except for statusbar
*/
+ (float)heightView
{
return UIScreen.mainScreen.bounds.size.height - [self heightOfStatusBar];
}
/*
* This method and returns height of tabbar
*/
+ (float)heightOfTabbar{
return 60.0f;
}
/*
* This method and returns height of status bar
*/
+ (float)heightOfStatusBar{
return 20.0f;
}
/*
* This method calculates and returns
* indentation of the inner object in the outer object, by width
*/
+ (float)getOffsetXFromBoxWidth:(float)boxWidth andObjectWidth:(float)objectWidth
{
return (boxWidth - objectWidth) / 2;
}
/*
* This method calculates and returns
* indentation of the inner object in the outer object, by heights
*/
+ (float)getOffsetYFromBoxHeight:(float)boxHeight andObjectHeight:(float)objectHeight
{
return (boxHeight - objectHeight) / 2;
}
/*
* from UIView to uiimage
*/
+ (UIImage *) imageWithView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
@end