//
// CCUIScreen.h
// CCFC
//
//
#import <Foundation/Foundation.h>
// the width and height of the screen
#define MACRO_SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define MACRO_SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define MACRO_APP_FRAME [[UIScreen mainScreen] applicationFrame]
#define MACRO_MAIN_SCREEN_RECT CGRectMake(0, 0, MACRO_SCREEN_WIDTH, MACRO_SCREEN_HEIGHT)
#ifndef MACRO_FULL_SCREEN
#define MACRO_FULL_SCREEN [[UIScreen mainScreen] bounds]
#endif
#define MACRO_DEFAULT_STATUSBAR_HEIGHT 20
#define MACRO_DEFAULT_NAVIGATIONBAR_HEIGHT 44
#define MACRO_DEFAULT_SCREEN_WIDTH 320
#define MACRO_DEFAULT_SCREEN_HEIGHT 480
#define MACRO_DEFAULT_TAB_BAR_HEIGHT 49
#define MACRO_DEFAULT_TAB_BAR_ICON_WIDTH 30
#define MACRO_DEFAULT_TAB_BAR_ICON_HEIGHT 30
#define MACRO_PPI_ON_IPHONE4 326
#define MACRO_PPI_UNDER_IPHONE4 163
#define MACRO_DEFAULT_IPAD_SCR_WIDTH 768
#define MACRO_DEFAULT_IPAD_SCR_HEIGHT 1024
@interface UIScreen(cc)
- (CGFloat)width;
- (CGFloat)height;
- (CGFloat)appWidth;
- (CGFloat)appHeight;
@end
//
// CCUIScreen.m
// CCFC
//
//
#import "CCUIScreen.h"
@implementation UIScreen(cc)
- (CGFloat)width
{
return [[UIScreen mainScreen] bounds].size.width;
}
- (CGFloat)height
{
return [[UIScreen mainScreen] bounds].size.height;
}
- (CGFloat)appWidth
{
return [[UIScreen mainScreen] applicationFrame].size.width;
}
- (CGFloat)appHeight
{
return [[UIScreen mainScreen] applicationFrame].size.height;
}
@end
微风不燥,阳光正好,你就像风一样经过这里,愿你停留的片刻温暖舒心。
我是程序员小迷(致力于C、C++、Java、Kotlin、Android、iOS、Shell、JavaScript、TypeScript、Python等编程技术的技巧经验分享),若作品对您有帮助,请关注、分享、点赞、收藏、在看、喜欢,您的支持是我们为您提供帮助的最大动力。
欢迎关注。助您在编程路上越走越好!