-(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 не загружая новый вид
добавлено действиеSheet.delegate = self; но все же не отображать вид измененный, что тоже делегировать: self in init – user1120133
Метод делегата должен быть '- (void) actionSheet: (UIActionSheet *) actionSheet clickedButtonAtIndex: (NSInteger) buttonIndex' (обратите внимание на нижний регистр.) Можете ли вы поставить точку останова по этому методу затем подтвердить, называется ли метод? – FluffulousChimp
выглядит так, как этот метод не называется. Я определил этот метод прямо под методом displayActionSheet на mainviewcontroller – user1120133