码迷,mamicode.com
首页 > 其他好文 > 详细

UIScreen

时间:2015-08-31 12:01:40      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

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];

  •    }

  • }




UIScreen

标签:

原文地址:http://my.oschina.net/u/1536972/blog/499392

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!