Objective c 如何将弹出窗口中的按钮设置为垂直显示

Objective c 如何将弹出窗口中的按钮设置为垂直显示,objective-c,macos,Objective C,Macos,为了让它看起来像这样,我的代码是 - (int)ldapAlertMessage:(NSString *)alertMessage { int x=0; if (nil != alertMessage) { NSImage *alertIcon = [NSImage imageNamed:@"security_alert_icon"]; NSAlert *alert = [[NSAlert alloc]init]; [alert a

为了让它看起来像这样,我的代码是

- (int)ldapAlertMessage:(NSString *)alertMessage
{
    int x=0;
    if (nil != alertMessage) {
        NSImage *alertIcon = [NSImage imageNamed:@"security_alert_icon"];
        NSAlert *alert = [[NSAlert alloc]init];
        [alert addButtonWithTitle:@"Yes"];
        [alert addButtonWithTitle:@"No"];
         [alert addButtonWithTitle:@"Cancel"];
        [alert setMessageText:alertMessage];
        [alert setAlertStyle:NSWarningAlertStyle];
        [alert setIcon:alertIcon];
        [[alert window] setBackgroundColor: NSColor.whiteColor];
        int result= [alert runModal];
        switch(result)
        {
    case NSAlertFirstButtonReturn:
            {
                x=1;
                return x;
                break;
            }
    case NSAlertSecondButtonReturn:
            {
                x=2;
                return x;
                break;
            }

            case NSAlertThirdButtonReturn:
            {
                x=3;
                return x;
                break;
            }

        }
           }

    return x;

}

   user_response = [self ldapAlertMessage: @"You will no longer be able to access your ldap login on this device if you select this."];
根据按钮下定义的用户响应执行操作


我想要一种方法来知道如何使我的按钮垂直显示,因为我会将文本yes,no更改为更大的文本。

您可以使用
UIActionSheet
而不是
UIAlertView
。即使我也有同样的问题。有没有办法在弹出窗口中获取复选框和单选按钮。