i was just wondering wether it is possible to add an uiimageview as a .m and .h class file because you can just choose a subclass from uiview or uitableviewcell in apple’s templates and it than automatically creates the .m and .h files.
Is there a way to do the same for an UIImageView or is it possible to somehow “turn” the UIView into an imageview?
thanks in advance!
You could create you own subclass of
UIImageView, yes. And if you’re very brave, you could also create your own subclass ofUIViewas well, that would take aUIImageand paint that in it’s-(void)drawRect:method. Then it would be much like aUIImageView.But, why would you?
edit subclassing
UIImageViewis easiest by starting with theUIViewsubclass template, and then just replacing the wordUIViewwithUIImageView, so you get:That’s all there is to it, now just use
UIImageViewPluswherever you would useUIImageView.