macos 弹窗

 //    MainNewsInformationViewController *vc = [[MainNewsInformationViewController alloc]init];
    //    NSPanel *panel = [NSPanel panelWithViewController:vc frame:CGRectMake([[NSScreen mainScreen] frame].size.width *0.5-500, [[NSScreen mainScreen] frame].size.height*0.5-309, 1000, 618)];
    //    [panel makeKeyAndOrderFront:self];
    
    //三个按钮都有
    NSUInteger style = NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable|NSWindowStyleMaskClosable|NSWindowStyleMaskUtilityWindow;
    NSWindow *window = [[NSWindow alloc] initWithContentRect:CGRectMake([[NSScreen mainScreen] frame].size.width *0.5-500, [[NSScreen mainScreen] frame].size.height*0.5-309, 1150, 711) styleMask:style backing:NSBackingStoreBuffered defer:NO];

    NSWindowController *dalishiWindowVC = [[NSWindowController alloc] initWithWindow:window];
    MainNewsInformationViewController *vc = [[MainNewsInformationViewController alloc] init];
    dalishiWindowVC.contentViewController = vc;
    [dalishiWindowVC.window setTitle:TBLocalizedString(@"资讯")];

    [window center];
    [dalishiWindowVC showWindow:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:window];

 

posted on 2023-09-26 18:00  高彰  阅读(64)  评论(0)    收藏  举报

导航