-(void)displayActionSheet:(id)sender
{
actionSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:nil
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Devanagari", @"English", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet showInView:self.view ];
[actionSheet release];
}
-(void)ActionSheet:(UIActionSheet *)ActionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if(actionSheet == actionSheet)
{
switch (buttonIndex) {
case 0:{
//Devanagari view display
ButtonViewController *controller1 = [[ButtonViewController alloc]init];
controller1.delegate = self;
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:controller1];
navigationController.navigationBar.tintColor = [UIColor colorWithHue:2.0/12 saturation:2.0 brightness:4.0/10 alpha:1.0];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
break;
}
}
}
}
當我按下梵文按鈕時,它應該加載一個新的視圖,但它只是解僱UIActionSheet
而不加載新的視圖。
我在這裏做錯了什麼?UIActionSheet button不加載新視圖
added actionSheet.delegate = self;但仍然沒有顯示視圖改變,太多委託:自我在初始化 – user1120133 2012-03-09 22:26:51
委託方法應該是' - (空)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger的)buttonIndex'(注意小寫),你可以把一個斷點然後確認該方法是否被調用? – FluffulousChimp 2012-03-09 22:30:11
貌似這個方法不會被調用我定義這個方法正下方的mainviewcontroller – user1120133 2012-03-09 22:33:54