开发者

Drawing a line in a UIView subview

开发者 https://www.devze.com 2023-01-11 21:17 出处:网络
I have a UIView subclass. This subclass has multiple subviews. Is i开发者_StackOverflow社区t possible to draw a line using core graphics inside a subview that is part of the uiview subclass?

I have a UIView subclass. This subclass has multiple subviews. Is i开发者_StackOverflow社区t possible to draw a line using core graphics inside a subview that is part of the uiview subclass?

For example, I have a SampleView class, which is a subclass of UIView. Inside this class's header file is the property for UIView *sampleSubView, which is a subview of SampleView. Is it possible to draw a line inside of sampleSubView from the SampleView class implementation?

Thanks for your help! Josh


If you are asking how a UIView subclass can draw a line on itself, then see the Quartz demo sample code. Basically, you'll override the view's drawRect: method, get the current graphics context, then draw whatever you like onto it.

If you are asking how one view can draw a line on another view, perhaps you need to rethink your architecture.

0

精彩评论

暂无评论...
验证码 换一张
取 消