views:

177

answers:

1

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.

+2  A: 

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?

Jasarien
Yeah, I know you're only supposed to have one view controller's views on screen at a time. The imageview will take up the whole screen. It will also have subviews.Sounds like you're saying there is nothing functionally wrong with it, which is good, because I went ahead and did it. I'll report back if anyone is tragically killed as a result of my abuse of MVC. ;)
Kenny Winker
Reporting back six hours later, I have to say it ended up being a dumb move. I thought I was taking out a level of complexity, but really I was limiting my options. If those sound like two sides of the same coin, you are correct.
Kenny Winker