NSAlert resize window

后端 未结 1 603
情歌与酒
情歌与酒 2020-12-19 23:02

I have several NSAlert dialogs with different text. I want to adjust the alert window width to the text, so that the text don\'t wrap. Therefore I use this code to calculate

1条回答
  •  粉色の甜心
    2020-12-19 23:47

    An NSAlert can be widened by adding an accessory view of sufficient width:

    NSAlert *alert = [[[NSAlert alloc] init] autorelease];
    alert.accessoryView = [[[NSView alloc] initWithFrame:NSMakeRect(0, 0, 500, 0)] autorelease];
    

    0 讨论(0)
提交回复
热议问题