从自身中解除自我现在的观点

时间:2017-03-11 17:45:05

标签: ios objective-c iphone uiviewcontroller

我有一个Web视图控制器,假设为A

weviewcontrollerA包含顶部ButtonA和ButtonB

的2个按钮

现在我的问题是

从另一个ViewControllerX我通过传递URL作为参数来加载weviewcontrollerA,以在webviewControllerA视图中加载www.google.com。

例如:

-(IBAction)loadweviewcontrollerA
{
 weviewcontrollerA *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"weviewcontrollerA"];
     vc.urltoload=@"https://wwww.google.com";
     [self presentViewController:vc animated:NO completion:nil];
}

现在在webviewcontrollerA中,我必须使用以下条件重新加载相同的视图 1)重新加载viewDidload(或再次出现同一个类)是必须的,因为我必须将uRL中的一些参数作为HTTPRequest传递给weburl

2)如何解雇webviewcontrollerA,然后在没有用户知道的情况下突然再次加载它。

我如何跳转,在代码工作之下,但是用户看到ViewControllerX并再次加载它,我如何跳过那个用户看不到ViewControllerX或者它加载得如此之快而没有用户注意

-(IBAction)ButtonA
{
[self dismissViewControllerAnimated:NO
                                completion:^{
 weviewcontrollerA *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"weviewcontrollerA"];
     vc.urltoload=@"https://wwww.facebook.com";
   UIViewController *topvc=[self topMostController];
                                    [topvc presentViewController:vc animated:NO completion:nil];
                                    //[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:vc animated:YES completion:nil];
                                }];





-(IBAction)ButtonG
{
[self dismissViewControllerAnimated:NO
                                completion:^{
 weviewcontrollerA *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"weviewcontrollerA"];
     vc.urltoload=@"https://wwww.twitter.com";
      UIViewController *topvc=[self topMostController];
                                    [topvc presentViewController:vc animated:NO completion:nil];
                                    //[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:vc animated:YES completion:nil];
                                }];



//----------- END OF MORE INFO POP UP VIEW---------------

- (UIViewController*) topMostController
{
    UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;

    while (topController.presentedViewController) {
        topController = topController.presentedViewController;
    }

    return topController;
}

0 个答案:

没有答案