132nd Day As An iOS Developer - Dealing With QR Scanner And Video Preview

March 16, 2016 - 132nd Day As An iOS Developer

WEDNESDAY - Today, my partner and I celebrated our 33rd month as a couple. One great thing happened today to me is that I answered a certain question on Stackoverflow. It was my first time to do that. I would love to continue helping others through that forum and hopefully someday, this year, real students in person - in short, I hope I can teach in my alma matter.

Today I dealt again with the video and audio in iOS, as well as with the QR functionality. Actually, you can make your own QR Scanner using the framework in iOS.

I would also like to share one thing to you guys, and I'm hoping this blog post would help anyone in the future who's having the same problem. Just like what I've mentioned above, I worked with the QR and video/audio functionality of my current project, and having a bug is inevitable while doing your app. My video preview is not full screen when the app is being run in iPhone6 and iPhone 6 plus. I am using autolayout and base on my constraints, the video preview should fill the parent's height and width, but it didn't.

SOLUTION: Implement a method called: viewDidLayoutSubviews -- Inside that method, layout again your video preview layer. IMPORTANT!: Do not alloc init anything inside that method, just re-layout your views. After that, your video preview will fill the height and width of its parent, or whatever you've been targetting.

Post a Comment