UIAlertView with 3 buttons hides message in landscape mode

一曲冷凌霜 提交于 2019-11-30 17:07:12

问题


My UIAlertView has a message and 3 buttons, my problem is the alert view display normally in portrait but it hides message in landscape mode as below screenshots. How to make the message appears? Thanks in advance.


回答1:


I too got same problem,

But I solved this, with a small change. like add "\n\n" at the end of Title in the alertView

This is not a correct solution. but this will rectify that problem some what.

*Note : The Title and the Message should be of one line text.

Thanks,

Satya




回答2:


By merging the Title String into the Message String you can fit two lines of landscaped text. Localization wise, this is a problem for many of us so I'm going to file a bug with Apple as it appears we aren't the only ones dealing with this problem.

Note: Any LS_ strings in my system are referenced from the Localizable.strings file.

So I went from:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"LS_Prompt_RateApp_Title", NULL)
                                                        message:(@"LS_Prompt_RateApp_Message", NULL)
                                                       delegate:self
                                              cancelButtonTitle:NSLocalizedString(@"LS_Prompt_RateApp_Never", NULL)
                                              otherButtonTitles:NSLocalizedString(@"LS_Prompt_RateApp_OK", NULL),
                                                                NSLocalizedString(@"LS_Prompt_RateApp_Cancel", NULL),
                              nil];

I have screenshots but it won't let me due to being a new account so here's a text version:

    [ TITLE LINE 1 ]
    [              ] ( message is clipped )
    [ Button #1    ]
    [ Button #2    ]
    [              ]
    [ Button Cancel]

to:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"LS_Prompt_RateApp_Prompt", NULL)
                                                        message:NULL
                                                       delegate:self
                                              cancelButtonTitle:NSLocalizedString(@"LS_Prompt_RateApp_Never", NULL)
                                              otherButtonTitles:NSLocalizedString(@"LS_Prompt_RateApp_OK", NULL),
                                                                NSLocalizedString(@"LS_Prompt_RateApp_Cancel", NULL),
                              nil];

I have screenshots but it won't let me due to being a new account so here's a text version:

[ TITLE LINE 1 ]
[ TITLE LINE 2 ] ( message == NULL )
[ Button #1    ]
[ Button #2    ]
[              ]
[ Button Cancel]



来源:https://stackoverflow.com/questions/7901834/uialertview-with-3-buttons-hides-message-in-landscape-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!