带有两个堆叠按钮的 UIAlertView(或 LMAlertView)
UIAlertView (or LMAlertView) with two stacked buttons
如何创建带有两个堆叠按钮的 UIAlertView
?而不是并排放置两个按钮?在我的项目中,我也使用 LMAlertView
(GitHub repository),我认为它会支持它们,但我找不到获得那种非常 UIAlertView 风格的方法。
目前我使用以下代码创建了一个 UIAlertView:
LMAlertView *applicationUpdateAlert = [[LMAlertView alloc] initWithTitle:alertTitleFromServer
message:alertMessageFromServer
delegate:self
cancelButtonTitle:NC(@"Aggiorna ora")
otherButtonTitles:NC(@"Ricordamelo più tardi"), nil];
[applicationUpdateAlert show]
我不知道这是否有助于您更好地理解,但 LMAlertView
有一个名为 buttonsShouldStack
的 属性,我认为它对我有用,但我不能正常使用,这是LMAlertView.m文件(direct link)中与buttonsShouldStack
相关的代码:
- (void)setButtonsShouldStack:(BOOL)buttonsShouldStack
{
_buttonsShouldStack = buttonsShouldStack;
if (self.numberOfButtons == 2) {
[self.buttonTableView reloadData];
[self.otherTableView reloadData];
}
}
谢谢
也许你可以试试这个library。它有一个满足您需求的演示项目。
我通过 "rewriting" LMAlertView
组件解决了这个问题,以便将 UIAlertView
按钮视为 UITableView
的单元格,并通过设置 rowNumber
因此,如果警报必须显示 1 个、2 个或更多按钮。这不是一个容易展示的解决方案,所以我不会在这里分享代码,也因为我不知道它是否经过 Apple 的批准安全。[=14=]
谢谢大家!
如何创建带有两个堆叠按钮的 UIAlertView
?而不是并排放置两个按钮?在我的项目中,我也使用 LMAlertView
(GitHub repository),我认为它会支持它们,但我找不到获得那种非常 UIAlertView 风格的方法。
目前我使用以下代码创建了一个 UIAlertView:
LMAlertView *applicationUpdateAlert = [[LMAlertView alloc] initWithTitle:alertTitleFromServer
message:alertMessageFromServer
delegate:self
cancelButtonTitle:NC(@"Aggiorna ora")
otherButtonTitles:NC(@"Ricordamelo più tardi"), nil];
[applicationUpdateAlert show]
我不知道这是否有助于您更好地理解,但 LMAlertView
有一个名为 buttonsShouldStack
的 属性,我认为它对我有用,但我不能正常使用,这是LMAlertView.m文件(direct link)中与buttonsShouldStack
相关的代码:
- (void)setButtonsShouldStack:(BOOL)buttonsShouldStack
{
_buttonsShouldStack = buttonsShouldStack;
if (self.numberOfButtons == 2) {
[self.buttonTableView reloadData];
[self.otherTableView reloadData];
}
}
谢谢
也许你可以试试这个library。它有一个满足您需求的演示项目。
我通过 "rewriting" LMAlertView
组件解决了这个问题,以便将 UIAlertView
按钮视为 UITableView
的单元格,并通过设置 rowNumber
因此,如果警报必须显示 1 个、2 个或更多按钮。这不是一个容易展示的解决方案,所以我不会在这里分享代码,也因为我不知道它是否经过 Apple 的批准安全。[=14=]
谢谢大家!