监听窗口拉伸,进入全屏,即将推出全屏,已经推出全屏,最小化,窗口关闭
观察窗口拉伸
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(screenResize)name:NSWindowDidResizeNotificationobject:nil];
-(void)screenResize{
//NSLog(@"观察窗口拉伸");
//NSLog(@"%.2f===%.2f",self.view.bounds.size.width,self.view.bounds.size.height);
}
即将进入全屏
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(willEnterFull:)name:NSWindowWillEnterFullScreenNotificationobject:nil];
-(void)willEnterFull:(NSNotification*)notification{
NSLog(@"即将全屏");
}
即将推出全屏
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(willExitFull:)name:NSWindowWillExitFullScreenNotificationobject:nil];
-(void)willExitFull:(NSNotification*)notification {
NSLog(@"即将推出全屏");
}
已经推出全屏
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(didExitFull:)name:NSWindowDidExitFullScreenNotificationobject:nil];
-(void)didExitFull:(NSNotification*)notification{
NSLog(@"推出全屏");
}
窗口最小化
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(didMiniaturize:)name:NSWindowDidMiniaturizeNotificationobject:nil];
-(void)didMiniaturize:(NSNotification*)notification{
NSLog(@"窗口变小");
}
窗口即将关闭
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(willClose:)name:NSWindowWillCloseNotificationobject:nil];
-(void)willClose:(NSNotification*)notification{
NSLog(@"窗口关闭");
}
关于Mac开发的随笔记(以下皆是作者随笔)
希望大家多多支持:
此文已由作者授权,转载请注明文章出处
网友评论