Instantiating a UIView query


#1

On page 91 a view is created programmatically as opposed to using IB.

While I appreciate the fact that we can create a view both ways, I wish the authors would have explained why - in this case, the view was created via code. Was it because this was the only way to accomplish this task in this particular case? Or was this the easiest way to do it?

It would be very helpful to me and perhaps others as well, if a singular example were given which would demo doing this (or any other) task both ways: programmatically and using IB.

This book has an incredible amount of knowledge which I sincerely appreciate. I have gone back over the first 100 pages several times and every time I do I find invaluable info that I somehow overlooked. However, when I stumble across situations as mentioned above I cannot help but wonder.

Thanks,
Phillip Anthony


#2

Sorry for the late response.

By this point, you’ve probably got to the next chapter and seen the discussion: when you have one view, do it programmatically, when you have multiple subviews, do it with a XIB. (Or whichever one you’re feeling like, really a personal preference.)