NSAlert做弹窗

xiaoxiao2021-02-28  99

    NSTextView *accessory = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,200,15)];

    NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSize]];

    NSDictionary *textAttributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];

    [accessory insertText:[[NSAttributedString alloc] initWithString:@"新的颜色设置保存完成."

                                                          attributes:textAttributes]];

    [accessory setEditable:NO];

    [accessory setDrawsBackground:NO];

    

    NSAlert *alert = [[NSAlert alloc] init];

    alert.messageText = @"通知信息:";

//    [alert setInformativeText:@"Informative text."];

    alert.accessoryView = accessory;

    [alert runModal];

    [alert release];

转载请注明原文地址: https://www.6miu.com/read-38308.html

最新回复(0)