Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Why UIViewcontroller not showing up on screen when i start with React native NativeModule?

$
0
0

I have a problem. when i call UIViewController from React native code in ios it shows new View as Shown in first image but, not showing As i designed in story board. please any solutions?

here is the first image,https://i.stack.imgur.com/4RNkP.jpg

here is the storyboard image,

https://i.stack.imgur.com/fo171.png

here is my ViewController.h,

using namespace cv;@interface ViewController : UIViewController<CvVideoCameraDelegate>{  IBOutlet UIImageView* imageView;  IBOutlet UIButton* button;}@property (nonatomic, strong) CvVideoCamera* videoCamera;@endHERE is the ViewController.m file,#import <opencv2/videoio/cap_ios.h>#import "ViewController.h"using namespace cv;@interface ViewController(){  CvVideoCamera* videoCamera;}@end@implementation ViewController- (void)viewDidLoad{  [super viewDidLoad];  // Do any additional setup after loading the view, typically from a nib.  self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];  self.videoCamera.delegate = self;  self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionFront;  self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288;  self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;  self.videoCamera.defaultFPS = 30;  self.videoCamera.grayscaleMode = NO;}-(void)viewDidAppear:(BOOL)animated{  [self.videoCamera start];}#pragma mark - Protocol CvVideoCameraDelegate#ifdef __cplusplus- (void)processImage:(Mat&)image;{  // Do some OpenCV stuff with the image  Mat image_copy;  cvtColor(image, image_copy, COLOR_BGR2GRAY);  // invert image  bitwise_not(image_copy, image_copy);  //Convert BGR to BGRA (three channel to four channel)  Mat bgr;  cvtColor(image_copy, bgr, COLOR_GRAY2BGR);  cvtColor(bgr, image, COLOR_BGR2BGRA);}#endif#pragma mark - UI Actions- (IBAction)actionStart:(id)sender;{  [self.videoCamera start];}@endHERE IS THE CODE TO CALL UIVIEWCONTRLLER,RCT_EXPORT_METHOD(ShowCamera) {  dispatch_async(dispatch_get_main_queue(), ^{    ViewController *controller ;    controller = [[ViewController alloc] init];    UIViewController *rooterController;    rooterController = [UIApplication sharedApplication].keyWindow.rootViewController;    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];    [rooterController presentViewController:nav animated:YES completion:nil];  });}

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>