0
은 tabbarbutton에 작업 시트를 표시 한 후 segue를 호출하는 방법을 알고 싶어합니다.tabbarbutton에서 위젯 시트를 누른 후 segue를 호출하는 방법
appdelegate가이 작업을 수행하기에 적합하지 않은 경우이 작업을 애플리케이션 위임에서 모두 수행했습니다. 해당 코드 줄을 어디에 추가해야합니까?
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
NSInteger choice = 1; // --> index of the view controller that should "act as button"
if (viewController == [tabBarController.viewControllers objectAtIndex:choice])
{
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:Nil
otherButtonTitles:@"000", @"Car Accident",@"Home",@"Property", nil];
sheet.tag = 0;
[email protected]"test";
NSLog(@"tab tab");
[sheet showInView:self.window];
return NO;
}
NSLog(@"YES YES");
return YES;
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if(actionSheet.tag == 0)
{
if (buttonIndex == 0)
{
UIDevice *device = [UIDevice currentDevice];
if ([[device model] isEqualToString:@"iPhone"])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt:000"]];
} else
{
UIAlertView *Notpermitted=[[UIAlertView alloc] initWithTitle:@"Alert" message:@"Your device doesn't support this feature." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[Notpermitted show];
}
}
else if (buttonIndex == 1)
{
NSLog(@"Car Accident");
//tried to call a segue here.
}
else if (buttonIndex == 2)
{
NSLog(@"YES YES");
}
else if (buttonIndex == 3)
{
NSLog(@"YES YES");
}
}
}
읽어 주셔서 감사합니다.