How do you update a secondary view?

Posted by Troy Sartain on Stack Overflow See other posts from Stack Overflow or by Troy Sartain
Published on 2010-05-10T16:26:28Z Indexed on 2010/05/11 2:44 UTC
Read the original article Hit count: 198

Perhaps there's a better way to set this up so I'm open to suggestions.

But here's what I'm doing. I have a main UIView. On top of that I have a UIImageView and another UIView. When the UIImageView changes, I want to change the second UIView. So I have a class for it and the IB object's type is set to the class. In the .m of that class is a drawRect method that draws some rectangles. Also in the .m is a NSMutableArray property that is synthesized. I created an instance of that class in the controller of the main view.

The problem: despite the fact that the drawRect works fine when the app starts (as traced in the debugger,) when the UIImageView changes I call a "setNeedsDisplay" on the instance variable of the second view after updating the @synthesize'd array but the drawRect does not get called.

I think it has to do with instances. I wouldn't think threading would be an issue here. I just want to draw in a separate area of the screen based on an image also displayed.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about setneedsdisplayinrect