UIScreen

UIScreen 对象定义了与硬件显示的相关属性,IOS设备有一个主屏幕,0个或是多个附加屏幕,用这个类来获取附加到设备屏幕的对象,每个Screen对象都定义了矩形边界和一些其他有趣的属性brightness。

处理通知

  • - (void)handleScreenConnectNotification:(NSNotification*)aNotification {
  •    UIScreen*    newScreen = [aNotification object];
  •    CGRect        screenBounds = newScreen.bounds;
  •    if (!_secondWindow) {
  •        _secondWindow = [[UIWindow alloc] initWithFrame:screenBounds];
  •        _secondWindow.screen = newScreen;
  •        // Set the initial UI for the window and show it.
  •        [self.viewController displaySelectionInSecondaryWindow:_secondWindow];
  •        [_secondWindow makeKeyAndVisible];
  •    }
  • }
  • - (void)handleScreenDisconnectNotification:(NSNotification*)aNotification {
  •    if (_secondWindow) {
  •        // Hide and then delete the window.
  •        _secondWindow.hidden = YES;
  •        [_secondWindow release];
  •        _secondWindow = nil;
  •        // Update the main screen based on what is showing here.
  •        [self.viewController displaySelectionOnMainScreen];
  •    }
  • }
时间: 2024-12-30 03:38:17

UIScreen的相关文章

UIScreen的scale属性

A UIScreen object contains the bounding rectangle of the device’s entire screen. When setting up your application’s user interface, you should use the properties of this object to get the recommended frame rectangles for your application’s window. UI

UIScreen, UIWindow

模仿书上或网上的例子,每次最开始就是 在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 加: self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = [[WXC

【笔记】[[UIScreen mainScreen] bounds]和 [[UIScreen mainScreen] applicationFrame]区别

[[UIScreen mainScreen] bounds]和 [[UIScreen mainScreen] applicationFrame]区别 新手学习阶段,一直知道UIScreen有这两个方法,但是经常忘记,现在记下来,方便以后查吧. 1.[[UIScreen mainScreen] bounds] 指屏幕的整个空间 2.[[UIScreen mainScreen] applicationFrame] 除却状态栏的整个空间 不同iPhone设备各个屏幕分辨率: 4/4S : 320*48

UIScreen,UIFont,UIColor,UIView,UIButton等总结

6.1 UIScreen // 屏幕的宽度 CGFloat screenW = [UIScreen mainScreen].bounds.size.width; 6.2 UIFont + (UIFont *)systemFontOfSize:(CGFloat)fontSize;   系统默认字体 + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;  粗体 + (UIFont *)italicSystemFontOfSize:(CGFloat)f

wift - 使用UIScreen类获取屏幕大小尺寸

UISreen类代表了屏幕,开发中一般用来获取屏幕相关的属性,例如获取屏幕的大小. 1 2 3 4 5 6 7 //获取屏幕大小 var screenBounds:CGRect = UIScreen.mainScreen().bounds println(screenBounds) //iPhone6输出:(0.0,0.0,375.0,667.0) //获取屏幕大小(不包括状态栏高度) var viewBounds:CGRect = UIScreen.mainScreen().applicati

Apple开发者文档中关于UIApplication/UIScreen/UIDevice的简述

UIApplication/UIScreen/UIDevice平常用的很少:但毕竟是属于UIKit的重要组成部分,有必要了解一下. UIDevice 通过UIDevice可以获取一个描述当前设备的单例.你可以获取以下设备相关的信息:设备名,设备型号,操作系统名称和版本. 我们还可以通过UIDevice实例检测设备的变化,比方横屏还是竖屏.Orientation属性代表了设备的方位,也可以通过注册UIDeviceOrientationDidChangeNotification通知消息来实时获取方位

iOS开发——UI篇OC篇&UIView/UIWindow/UIScreen/CALayer

UIView/UIWindow/UIScreen/CALayer 1.UIScreen可以获取设备屏幕的大小. 1 2 3 4 5 6 7 // 整个屏幕的大小 {{0, 0}, {320, 480}} CGRect bounds = [UIScreen mainScreen].bounds; NSLog(@"UIScreen bounds: %@", NSStringFromCGRect(bounds)); // 应用程序窗口大小 {{0, 20}, {320, 460}} CGRe

关于[[UIScreen mainScreen] bounds]和applicationFrame区别

可能有人对[[UIScreen mainScreen]bounds]和[UIScreen mainScreen]applicationFrame]的区别不是很了解,其实很简单. bounds就是屏幕的全部区域,包括状态栏. 而applicationFrame指的是app显示的区域,不包括状态栏. 如果你讲状态栏隐藏,他们两个就是一样的.

UISCREEN 和支持高分辨率的显示屏

UIScreen对象包含了整个屏幕的边界矩形.当构造应用的用户界面接口时,你应该使用该对象的属性来获得推荐的矩形大小,用以构造你的程序窗口. CGRect bound = [[UIScreen mainScreen] bounds];  // 返回的是带有状态栏的Rect CGRect frame = [[UIScreen mainScreen] applicationFrame];  // 返回的是不带有状态栏的Rect float scale = [[UIScreenmainScreen]

01- - -1.获得项目中info.plist文件的内容 2.沙盒的数据存储及读取 3.控制器view的高度和状态栏statusBar的关系 4.[UIScreen mainScreen].applicationFrame的取值 5.按钮的状态 6.错误调试技巧 7.按钮的各种状态设置

1.获得项目中info.plist文件的内容 1> [NSBundle mainBundle].infoDictionary 2> 版本号在info.plist中的key:kCFBundleVersionKey 2.沙盒的数据存储及读取 1> 数据存储: [[NSUserDefaults standardUserDefaults] setObject:version forKey:versionKey]; 存储数据时记得同步一下 [[NSUserDefaults standardUser