Closed toyhunter closed 10 years ago
The view's frame
(and thus its bounds
) is determined in viewWillAppear
.
After reading this though it seems that I should make these calculations in viewWillLayoutSubviews
.
Sorry, just checked again, and this special viewWillAppear
is in fact a message sent when the view is going to get added to a window.
If I understand, your problem is that the _previewLayer.frame
is not resized automatically if the camera view changes sizes afterwards right?
Exactly. Have I done something wrong for auto layout to get worked?
To clarify my problem, I use .xib with iphone5 layout. So at runtime the problem will occur if I run my app on, for example, iphone4s where camera view will have its bound determined after viewWillAppear.
Can you try readjusting _previewLayer.frame
in NBUCameraView?
http://stackoverflow.com/a/4098348/1049134
If that works please pull request the changes.
Readjusting the frame in layoutSubviews did solve my problem. Thank you so much, @rivera-ernesto.
Thanks to you!
Currently I have an issue to configure NBUCameraView's bound. I use auto layout, and it seems to me view's bound is not determined until viewDidAppear or viewDidLayoutSubviews. However, I notice NBUCameraView is initialized in viewWillAppear which makes its bound incorrectly configured.
Is it possible to change this initialization behavior or to perform initialization manually?