forked from shaojiankui/JKCategories
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jakey
committed
Jan 28, 2015
1 parent
9469314
commit 9b5e96e
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// UIResponder+UIAdapt.h | ||
// IOS-Categories | ||
// | ||
// Created by Jakey on 15/1/28. | ||
// Copyright (c) 2015年 www.skyfox.org. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface UIResponder (UIAdapt) | ||
CGRect CGAdaptRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height); | ||
CGPoint CGAdaptPointMake(CGFloat x, CGFloat y); | ||
-(CGFloat)factorAdapt; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// UIResponder+UIAdapt.m | ||
// IOS-Categories | ||
// | ||
// Created by Jakey on 15/1/28. | ||
// Copyright (c) 2015年 www.skyfox.org. All rights reserved. | ||
// | ||
|
||
#import "UIResponder+UIAdapt.h" | ||
#define XIB_WIDTH 320 | ||
|
||
@implementation UIResponder (UIAdapt) | ||
CGRect CGAdaptRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height) | ||
{ | ||
//UIScreenMode *currentMode = [[UIScreen mainScreen]currentMode]; | ||
CGRect sreenBounds = [UIScreen mainScreen].bounds; | ||
CGFloat scale = sreenBounds.size.width/XIB_WIDTH; | ||
return CGRectMake(x*scale, y*scale, width *scale, height*scale); | ||
} | ||
|
||
CGPoint CGAdaptPointMake(CGFloat x, CGFloat y){ | ||
//UIScreenMode *currentMode = [[UIScreen mainScreen]currentMode]; | ||
CGRect sreenBounds = [UIScreen mainScreen].bounds; | ||
CGFloat scale = sreenBounds.size.width/XIB_WIDTH; | ||
return CGPointMake(x*scale, y*scale); | ||
} | ||
|
||
-(CGFloat)factorAdapt{ | ||
//IScreenMode *currentMode = [[UIScreen mainScreen]currentMode]; | ||
CGRect sreenBounds = [UIScreen mainScreen].bounds; | ||
CGFloat scale = sreenBounds.size.width/XIB_WIDTH; | ||
return scale; | ||
} | ||
@end |