开发者

UIAlertView, how to place a lot of buttons inside it?

开发者 https://www.devze.com 2023-04-07 23:18 出处:网络
In UIAlertView, how can I place a lot of buttons inside it? I\'ve got an alert view and want to place ten buttons inside of it, but when in place, then they don\'t fit in the screen?

In UIAlertView, how can I place a lot of buttons inside it? I've got an alert view and want to place ten buttons inside of it, but when in place, then they don't fit in the screen? Moreover, how should I make the buttons look a little bit different, and how can I change their sizes?

UIAlertView *alert = [[UIAlertView alloc] initWithTitle开发者_C百科:@"Фильтр по категориям" message:@"Выбирите категорию:" delegate:self cancelButtonTitle:@"Отменить" 
                                          otherButtonTitles:@"Все", @"Избранное", @"Тосты", @"Рассказы", @"Стихи", @"Анекдоты", @"Афоризмы", @"Объявления", @"Разное", nil];

In English:

UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "Filter by Category" message: @ "Choose a category:" delegate: self cancelButtonTitle: @ "Cancel"
                                       otherButtonTitles: @ "All", @ "Music", @ "Toast", @ "Stories", @ "Poems", @ "Jokes", @ "Aphorisms", @ "Announcements", @ "Other", nil];


You should not place ten buttons inside a UIAlertView.

I don't know Russian so I have no clue as to the context of your problem. But there's no reason to put that many choices in an alert view.


Lorean is correct.

On the iPhone, for selecting a category filter, you should use a modal ViewController (with presentModalViewController), which will roll over your main view, allow them to select their category and then disappear.

On the iPad, you should use a UIPopoverController.


You might want to look on alternative alert view implementations https://github.com/TomSwift/TSAlertView

But be honest to yourself, if so many buttons make sense on a alert view. You also can use presentModalViewController to present a custom view, where you have all flexibility.

0

精彩评论

暂无评论...
验证码 换一张
取 消