Question

Is it bad form to point the view property of my UIViewController subclass directly at a UIImageView? Or should my UIImageView be embedded in a UIView?

I can't think of any problems with it, and it seems to work alright, but I thought I'd ask the hive-mind if there are any negative consequences to doing this.

Was it helpful?

Solution

It depends on your view hierarchy and how your app is designed.

If the image view is going to take up the entire screen and will be the only view managed by the view controller, then it shouldn't be a problem.

However, if there will be more views on screen, it would probably be better to embed it in a view that will take up the entire screen. Even then, in the spirit of MVC, it wouldn't be a bad idea to have one controller for the main view, and a different controller for the image.

I imagine it depends how much 'controlling' the image view requires?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top