我创建了一个框架,里面有3个视图控制器
用户APP视图名称
userViewController
|
clickherebtn to load Framework
框架appviews:
sdkview1controller
sdkview2controller
sdkview3controller
从App调用框架流程
on hit clickherebtn我加载了像tutorial way
这样的框架从sdkview1controller视图返回,只需使用
[self dismissViewControllerAnimated:NO completion:nil];
但如果我的主叫视图如何
userViewController - > sdkview1controller-> sdkview2controller-> sdkview3controller
现在我想在sdkview3controller中点击后退按钮跳回到userViewController
注意:userViewController的名称不固定,所以我的问题是 如何返回应用程序视图,直接跳过我框架中所有加载的视图?
答案 0 :(得分:1)
<div class="codeWriteOn">
<ul class="MonokaiBright">
<li>
<span><</span><span class="red">ul</span>
<span class="green">class</span>=<span class="yellow">“markup”</span><span>></span>
</li>
<li class="project1">
<span><</span><span class="red">li</span>
<span class="green">class</span>=<span class="yellow">“project1”</span><span>></span>
<!-- ">" --><span>Project-1<</span><span class="red">/li</span><span>></span>
</li>
<li class="project2">
<span><</span><span class="red">li</span>
<span class="green">class</span>=<span class="yellow">“project2”</span><span>></span>
<!-- ">" --><span>Project-2<</span><span class="red">/li</span><span>></span>
</li>
<li class="project3">
<span><</span><span class="red">li</span>
<span class="green">class</span>=<span class="yellow">“project3”</span><span>></span>
<!-- ">" --><span>Project-3<</span><span class="red">/li</span><span>></span>
</li>
<li class="project4">
<span><</span><span class="red">li</span>
<span class="green">class</span>=<span class="yellow">“project4”</span><span>></span>
<!-- ">" --><span>Project-4<</span><span class="red">/li</span><span>></span>
</li>
<li>
<</span><span class="red">/ul</span><span>></span>
</li>
</ul>
</div>
如果您使用//Start initial task
Task initTask = Xyz.Start();
//Continue initial task with something
Task continueTask = initTask.ContinueWith((obj)=> { /*work work*/ });
//Wait for the initial task to finish (not the continue)
initTask.Wait();
//Wait for the continue task to finish
continueTask.Wait();
添加了所有视图控制器(我假设您这样做了),这将解除所有链并让用户返回UIViewController *vc = self.presentingViewController;
NSArray* classes = @[[sdkview1controller class],
[sdkview2controller class],
[sdkview3controller class]];
while (vc.presentingViewController) {
vc = vc.presentingViewController;
if(! [classes containsObject:[vc class]])
break;
}
[vc dismissViewControllerAnimated:YES completion:NULL];
答案 1 :(得分:1)
在您的应用中 添加导航控制器作为rootviewcontroller并将框架viewcontroller推送为:
Common *com_obj = [Common sharedInstance];
com_obj.viewc =self; ////////assiging the app viewcontroller which will be used to pop
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"CommonBundle" ofType:@"bundle"];
NSBundle *mobtestBundle = [NSBundle bundleWithPath:bundlePath];
UIStoryboard *story=[UIStoryboard storyboardWithName:@"Main" bundle:mobtestBundle];
ViewController1 *viewc1=[story instantiateViewControllerWithIdentifier:@"ViewController1"];
[self.navigationController pushViewController:viewc1 animated:YES];
在你的sdk中
在您的对象类中添加一个属性作为id viewc
/////in sdkViewcontroller1 push as
ViewController2 *viewc1=[self.storyboard instantiateViewControllerWithIdentifier:@"ViewController2"];
[self.navigationController pushViewController:viewc1 animated:YES];
在后面的sdkViewcontroller2
中Common *common = [Common sharedInstance];
[self.navigationController popToViewController:common.viewc animated:YES];