I have problem withe dissmissing the tabbed view controller,can some body help.
Now coming to the processing steps.
My first viewcontroller is show in the fig below.
2.when I click any button I presenting the tabview controller
3.When I go the camera tab the tabedview is like below
4.when I press next I am presenting the view controller
5.I this viewcontroller when I press Share button we have to dissmiss to tabbed viewcontroller ie 1sttab in the tabeedview controller.show in the fig below
Waiting for the quick Responce and any is help is appreciated.
I have a solution for your problem. Please try this code to dismiss the view controller if you present the view using modal: //Swift
self.dismissViewControllerAnimated(true, completion: {});
//Objective C
[self dismissViewControllerAnimated:YES completion:nil];
In the completion handler do something like this to change the tab bar index:
NSInteger indexOfTabToSwitchTo = 1//Change this number according to your preference of controller
[self.presentingViewController.tabBarController setSelectedIndex:indexOfTabToSwitchTo];
/. Combined together may be it'll look something like this
[self dismissViewControllerAnimated:YES completion:^{
NSInteger indexOfTabToSwitchTo = 1//Change this number according to your preference of controller
[self.presentingViewController.tabBarController setSelectedIndex:indexOfTabToSwitchTo];
}];
You can use the selectedIndex property of tab bar controller to solve your issue
[self.tabBarController setSelectedIndex:0];
--
Try this
[self dismissViewControllerAnimated:NO completion:^{
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:@"ShareArray" object:_selectedimgarray];
[[NSNotificationCenter defaultCenter] postNotificationName:@"SharetitleArray" object:_newtile];
[[NSNotificationCenter defaultCenter] postNotificationName:@"sharevideooutputurl" object:_finalvideourl];
[self.tabBarController setSelectedIndex:0];
});
}];
You can use this code:
[self dismissViewControllerAnimated:YES completion:^{
[self.tabBarController setSelectedIndex:0];
}];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.