Iphone 从superview中删除WikitSDK

Iphone 从superview中删除WikitSDK,iphone,view,augmented-reality,wikitude,Iphone,View,Augmented Reality,Wikitude,我已实现Wikitude SDK,并使用以下代码进行初始化: -(IBAction)launchAR:(id)sender{ wikitudeAR = [[WikitudeARViewController alloc] initWithDelegate:self applicationPackage:nil applicationKey:nil applicationName:nil developerName:nil]; } - (void) verificationDi

我已实现Wikitude SDK,并使用以下代码进行初始化:

-(IBAction)launchAR:(id)sender{
        wikitudeAR = [[WikitudeARViewController alloc] initWithDelegate:self applicationPackage:nil applicationKey:nil applicationName:nil developerName:nil];  
}

- (void) verificationDidSucceed {

    BuddyFinderAppDelegate *appDel = (BuddyFinderAppDelegate *)[[UIApplication sharedApplication] delegate];


    [appDel.window addSubview: [wikitudeAR start]];
    [window makeKeyAndVisible]; 
}
@implementation CustomMenuButtonDelegateImpl1

- (void) customMenuButtonPressed:(WTPoi *)currentSelectedPoi {
    //NSLog(@"addpoi");



    [[WikitudeARViewController sharedInstance] hide];
    [UIApplication sharedApplication].statusBarHidden = NO;

    }


@end
如何返回MainViewController视图?
(我想从对象“custombutton”调用它)

我猜您的
WikitudeARViewController
委托是应用程序委托

@implementation CustomMenuButtonDelegateImpl1

- (void) customMenuButtonPressed:(WTPoi *)currentSelectedPoi {
    //NSLog(@"addpoi");



    [[WikitudeARViewController sharedInstance] hide];
    [UIApplication sharedApplication].statusBarHidden = NO;

    }


@end
1) 实现您自己的视图控制器,从您想要启动AR浏览器的位置(最好单击按钮)

@implementation CustomMenuButtonDelegateImpl1

- (void) customMenuButtonPressed:(WTPoi *)currentSelectedPoi {
    //NSLog(@"addpoi");



    [[WikitudeARViewController sharedInstance] hide];
    [UIApplication sharedApplication].statusBarHidden = NO;

    }


@end
2) 从ViewController(按钮事件)实例化WikitudeARViewController,并将ViewController作为代理

@implementation CustomMenuButtonDelegateImpl1

- (void) customMenuButtonPressed:(WTPoi *)currentSelectedPoi {
    //NSLog(@"addpoi");



    [[WikitudeARViewController sharedInstance] hide];
    [UIApplication sharedApplication].statusBarHidden = NO;

    }


@end
3) 使视图从[wikitudeAR start]返回到ViewController.view(而不是window.view)

@implementation CustomMenuButtonDelegateImpl1

- (void) customMenuButtonPressed:(WTPoi *)currentSelectedPoi {
    //NSLog(@"addpoi");



    [[WikitudeARViewController sharedInstance] hide];
    [UIApplication sharedApplication].statusBarHidden = NO;

    }


@end

希望这有帮助。

您可以使用CustomMenuButtoneLegateImpl1.m

@implementation CustomMenuButtonDelegateImpl1

- (void) customMenuButtonPressed:(WTPoi *)currentSelectedPoi {
    //NSLog(@"addpoi");



    [[WikitudeARViewController sharedInstance] hide];
    [UIApplication sharedApplication].statusBarHidden = NO;

    }


@end

它工作得很好

这是可行的,但如果我按下mainviewcontroller中的任何按钮,就会崩溃!BuddyFinderAppDelegate*appDel=(BuddyFinderAppDelegate*)[[UIApplication sharedApplication]委托];MainViewController*mvc=[[MainViewController alloc]init];[appDel.window addSubview:mvc.view];你好,谢谢你的回复。那么你是说我必须编写另一个视图控制器,并在那里启动wikitudeAR?这将很困难,因为我需要主视图控制器中的wikitude(用于传递初始化数据),而不是
[appDel.window addSubview:[wikitudeAR start]],请尝试[mvc.view addSubView:[wikitudeAR start]];`?我收到警告:找不到方法-addsubview(返回类型默认为'id')我的错误,它是一个输入错误:[mvc.view addsubview:[wikitudeAR start]]`
@implementation CustomMenuButtonDelegateImpl1

- (void) customMenuButtonPressed:(WTPoi *)currentSelectedPoi {
    //NSLog(@"addpoi");



    [[WikitudeARViewController sharedInstance] hide];
    [UIApplication sharedApplication].statusBarHidden = NO;

    }


@end