When is uiview drawrect called
EDIT2: Please see comments of selected answer for the gory details! Add a comment. Active Oldest Votes. Just call [self. Sam Ritchie Sam Ritchie It doesn't appear to be working! Is that line of code you added getting called? Check with NSLog, or with a breakpoint. Time Machine has a good point -- [self. In the nib file, make sure that when you click the MyView instance and go to the connections inspector Command-2 , you see a referencing outlet to File's Owner.
If not, click that little circle and drag the line over to File's Owner. When you release, select the right property. That way, you do initialize an array in the constructor, without assignments in the body.
This is what boost::array does. Or the invalidness of the above code is a corollary of some other rules? A mem-initializer uses direct initialization. And the rules of clause 8 forbid this kind of thing. I'm not exactly sure about the following case, but some compilers do allow it. Yes, they do. However your syntax is invalid, I think. You have to use braces directly to fire off list initialization.
You need to specify a frame that determines the origin and size of your view. Since you have a custom init method already I would do the following:. This will draw your custom view with an origin point of 0. Furthermore, adding a call to setNeedsDisplay should force the drawRect method to be called if you are still having trouble:. Asked By: KlimczakM. Ask Question. Asked 11 years, 8 months ago. Active 11 years, 8 months ago.
Viewed 7k times. Is it invoked just before the main view is going to be shown Can we call it whenever we want? TechZen 64k 15 15 gold badges silver badges bronze badges. Add a comment. Active Oldest Votes. It's called whenever the view or part of the view needs to be drawn or redrawn. TechZen TechZen 64k 15 15 gold badges silver badges bronze badges.
0コメント