标签:
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];
}
}
标签:
原文地址:http://my.oschina.net/u/1536972/blog/499392