我試圖創建一個簡單的網頁瀏覽器式的應用程序,其中當用戶想要使用一回,回家,或進功能他們被要求通過警報視圖進行確認。UIAlertView中沒有要求
控制檯窗口確認它沒有問題調用IBAction爲,但每當我希望它來調用警報查看出現空白。
任何幫助,將不勝感激。
- (IBAction)controlPanelActions:(id)sender{
if (_controlPanel.selectedSegmentIndex == 0)
{
if ([_viewWeb canGoBack])
{
[self askToGoHome:nil];
}
}
- (IBAction)askToGoHome:(id)sender {
UIAlertView *alertDialog;
alertDialog.tag = 2;
alertDialog = [[UIAlertView alloc]
initWithTitle: @"Confirm"
message:@"Continue with Home Action?"
delegate: self
cancelButtonTitle: @"Yes"
otherButtonTitles: @"No", nil];
[alertDialog show];
}
- (void)alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *buttonTitle=[alertView buttonTitleAtIndex:buttonIndex];
if (alertView.tag == 1)
{
if ([buttonTitle isEqualToString:@"Yes"])
{
NSLog(@"back - yes");
[_viewWeb goBack];
}
}
if (alertView.tag == 2)
{
NSLog(@"home - pre-yes");
if ([buttonTitle isEqualToString:@"Yes"])
{
NSLog(@"home - yes");
HOMEPAGEURL = [[NSURL alloc] initWithString:HOMEPAGE];
[self.viewWeb loadRequest:[NSURLRequest requestWithURL:HOMEPAGEURL]];
}
}
if (alertView.tag == 3)
{
if ([buttonTitle isEqualToString:@"Yes"])
{
[_viewWeb goForward];
}
}
}
爲了便於說明,警報是否爲空白?還是完全跳過了? – 2014-11-03 02:00:01
按預期提示選項「是」和「否」。只有在選擇其中一個選項後纔會發生任何事情。 – user3246922 2014-11-03 02:02:02
' - (ID)initWithTitle:(的NSString *)標題信息:(* NSString的)消息委託:(ID)代表cancelButtonTitle:(的NSString *)cancelButtonTitle otherButtonTitles:(的NSString *)otherButtonTitles'我沒有看到的尾隨簽名其他按鈕標題後沒有?那個參數是什麼? – 2014-11-03 02:13:24