Re: Drawing something in UIViewController?
Re: Drawing something in UIViewController?
- Subject: Re: Drawing something in UIViewController?
- From: David Duncan <email@hidden>
- Date: Sat, 23 May 2009 21:20:10 -0700
On May 23, 2009, at 9:12 PM, Agha Khan wrote: Dear Sir:
I would like to draw some primitives to my UIViewController and at loadView I set it CGRect newRect = self.view.bounds; [self.view setNeedsDisplayInRect:newRect]; [self.view setNeedsDisplay];
These calls are redundant. You just asked for the view to invalidate its entire bounds twice. You only need the latter. and added -(void)drawRect:(CGRect)rect function.
Unless you added it to a UIView subclass, it will never be called.
How this can be done? My back ground is from Windows and this is my first application on IPhone.
My other question is how can I update the content of that UIViewController? Does this make any sense of this question?
A UIViewController is not a UIView subclass, and as such it won't do drawing for you. If you want to do custom drawing, then create a custom subclass of UIView and add your drawing there. I would recommend taking a look around the sample code. I don't recall anything off hand, but there are a few that create UIView subclasses for custom drawing. The UIView documentation would be useful to read as well.
-- David Duncan Apple DTS Animation and Printing
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden