Re: UIView as opposed to UIViewController...
Re: UIView as opposed to UIViewController...
- Subject: Re: UIView as opposed to UIViewController...
- From: Alexander Spohr <email@hidden>
- Date: Sun, 7 Mar 2010 10:39:13 +0100
Am 07.03.2010 um 03:57 schrieb Jon:
> I get indications from reading that you shouldn't really subclass UIView in general or to do routine things, and that any time you implement drawRect in the subclass of a UIView, you are taking a performance hit compared to doing some drawing in other ways?
No. Where does it say that?
A view draws data (like an image) but should know nothing about any model (that is is an image of a person record).
A view controller feeds the data (image of person) to its views.
So, if you have a special drawing ou need to perform subclass a view and implement drawRect.
> is this true, in the case of doing this in the ViewController, is this below more efficient? or better? or what?
Your example just adds a subview, nothing else. It make no sense for your question as you don’t draw anything.
> then drawing within an NStimer loop in this added subView inside the viewController? (the subview bounds are as big as the whole view)
NSTimer? What? Why? Please explain what you want to do.
> etc....
>
> I guess i am not sure which way to go.. (do everything in a UIView subclass, or do everything in a UIViewController subclass.)
Usually neither. You share the work between them.
Please read this:
http://developer.apple.com/iPhone/library/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.html
> it doesn't seem like anything you do in the controller, is easy to get to draw in a UIView subclass, and maybe equally hard to get stuff to translate over to the controller if you do a lot of work in the UIView...
If your view has to do "a lot of work" something is wrong.
The view just draws information. It does not work on them.
> i'm just lost as to how an NSTimer and a looping set of code should be worked into these two classes.. should it be in the UIView? or the Controller? seems like it should be in the controller, but then really all the work has to be in the controller, since you can't even call the drawRect while in the controller, so what would you do in the UIView?
>
> any of that make sense?
No. Because you did not tell at all what you try to achieve with your timer and view.
atze
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden