I’m learning to develop apps for Iphone. I follow a book by Apress which I find very useful. But as nothing is perfect some issues are not well described and just skipped.In one of the applications I have to assign five images to each of the five components of a pickerview. But my question is why do/can not we use an instance of UImage itself but UIImageView to display on the picker.
Share
As in above question you are asking why we can not use
UIImageinstead ofUIImageViewas component forUIPickerView.UIImageis subclass ofNSObjectclass, If we talk in terms of M-V-C its a M(model). and model in itself is nothing until its used.UIImageViewon the other hand is subclass ofUIViewwhich stands for V(view) in M-V-C so it uses your model for its contents.So, they are two different things, not alternate. Also, if you go through
UIPickerView‘s class documentation then you will find that it has methodthat configures view for specified row component. so it meanse we need view(
UIImageView) and not the model class(UIImage). here for component you can return subclass of UIView.Please refer apple’s documentation.
Thanks,