PhoneGap 2.3 - iOS上的Cleaver:Camera API

时间:2013-10-27 07:25:30

标签: ios cordova camera cordova-2.0.0

我已将CDVViewController嵌入到我自己的视图控制器中,以便可以调用PhoneGap API - Camera。

调用open camera API时,可以成功启动相机应用程序。然而,在拍摄相机并返回应用程序后,UIView(标题栏)消失,只有CDVViewController中的视图出现。

请帮忙。

ViewController.m:

- (void)viewDidLoad
{
    [super viewDidLoad];

    dispatch_async(dispatch_get_main_queue(), ^{
        //Header Bar
        headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, 100)];
        [self.view addSubview:headerView];

        //Webview
        self.viewController = [CDVViewController new];
        self.viewController.wwwFolderName = nil;
        self.viewController.startPage = self.landingURL;
        self.viewController.useSplashScreen = NO;
        self.viewController.view.frame = CGRectMake(0, 120, self.view.bounds.size.width, self.view.bounds.size.height - 120);
        self.viewController.webView.scalesPageToFit = YES;
        self.viewController.webView.delegate = self;
        [self.view addSubview:self.viewController.view];
}

ViewController.h:

#import <Cordova/CDVViewController.h>

@interface RPViewController : UIViewController <UIWebViewDelegate>
@property (retain, nonatomic) CDVViewController *viewController;
@property (retain, nonatomic) UIView *headerView;
@property (nonatomic, copy) NSString *landingURL;
@end

我的应用(原创):

*-----------------------------*
|     [UIView] (Header Bar)   |
|=============================|
|    [CDVViewController]      |
|                             |
|                             |
|                             |
*-----------------------------*

我的应用(从通过PhoneGap API打开相机返回后):

*-----------------------------*
|                             |
|                             |
|    [CDVViewController]      |
|                             |
|                             |
|                             |
*-----------------------------*

0 个答案:

没有答案