每次我在 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
。请帮忙 !