UIScreen

UIScreen 對象定義了與硬件顯示的相關屬性,IOS設備有一個主屏幕,0個或是多個附加屏幕,用這個類來獲取附加到設備屏幕的對象,每一個Screen對象都定義了矩形邊界和一些其餘有趣的屬性brightness。ide

處理通知
spa

  • - (void)handleScreenConnectNotification:(NSNotification*)aNotification {code

  •    UIScreen*    newScreen = [aNotification object];對象

  •    CGRect        screenBounds = newScreen.bounds;it

  •    if (!_secondWindow) {io

  •        _secondWindow = [[UIWindow alloc] initWithFrame:screenBounds];sed

  •        _secondWindow.screen = newScreen;object

  •        // Set the initial UI for the window and show it.date

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

  •    }

  • }

相關文章
相關標籤/搜索