Reputation: 3602
I want to show a new view on the screen. Before showing it, I want to initialize it with an image that was just capture by the camera. This is a part of the code:
[self.view addSubview:self.photoPreviewView.view];
UIImageView *photo = self.photoPreviewView.imageView;
[[self captureManager] captureStillImage:photo];
As you can notice, I first call the addSubView and only later setting the photo. I do it since the "imageView" (of "photoPreviewView.imageView") is only accessible after calling "addSubView".
This creates a not nice experience, when first the view is shown in white, and only then a photo is being shown.
Is there a way of handling this issue?
Upvotes: 1
Views: 635
Reputation: 31
Not really enough information - if photoPreviewView is created by loading from a NIB file and imageView is an IBOutlet then the linkages are not established for the imageView until after you have accessed the view attribute of photoPreviewView.
If this is the case simply do a
[self.photoPreviewView view];
[[self.captureManager captureStillImage:self.photoPreviewView.imageView];
[self.view add subView;self.photoPreviewView.view];
Upvotes: 1
Reputation: 4066
Not sure to understand your question but,
you can try this before your code :
[self.photoPreviewView.view addSubview:nil];
Maybe it will allow you to access to imageView
property of photoPreviewView
.
Let me know if it works or not.
Upvotes: 1