每當我按UIActionSheet中的取消按鈕,它都會運行一個方法。我不知道爲什麼,我多次查看了整個代碼,但仍然看不到問題。你能幫我找到它嗎?UIActionSheet,取消按鈕運行方法
-(IBAction)moreOptions
{
giftTitle = self.title;
if(![giftTitle isEqualToString:@"bla"])
{
actionSheet = [[UIActionSheet alloc]initWithTitle:giftTitle
delegate:self
cancelButtonTitle:@"Back"
destructiveButtonTitle:nil
otherButtonTitles:@"Send via email",
@"Read in Wikipedia"
, nil];
}
else
{
actionSheet = [[UIActionSheet alloc]initWithTitle:giftTitle
delegate:self
cancelButtonTitle:@"Back"
destructiveButtonTitle:nil
otherButtonTitles:@"Send via email",
@"Read in Wikipedia", @"Pineapple mode"
, nil];
}
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view.window];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
// выстраеваем дальнейшие действия кнопок
switch (buttonIndex)
{
case 0:
[self showPicker];
break;
case 1:
[self goWiki];
break;
case 2:
[self showPineapple];
break;
default:
break;
}
}
因此它運行方法showPineapple
。請幫忙 !
是的,它的工作!謝謝 ! 有趣的是,我從來沒有聽說過標籤屬性。 – SmartTree