开发者

How is NSCell displayed?

开发者_JAVA百科

An NSControl's cell isn't in the view hierarchy. Am I correct?

If it isn't, how is it being drawn on the view if it's not in the view hierarchy?

I ask because I want to have a View/Control subclass that I can drag out onto a contentview, then add buttons into that view, and have the lowest component be the cell. So the cell can get all the click events, do something, then pas them onto the buttons.

Window ->ContentView -> CustomView ->(Button, Button, Button)


NSResponder, thanks thats what I thought.

Costique, I always check apple's docs first. I was just looking for clarification.


Read Apple's docs. In a nutshell, a control's -drawRect: sends -drawInteriorWithFrame:inView: and/or -drawWithFrame:inView: to its cell which does the actual drawing.


A cell is not a view, it has no place in the view hierarchy. You should think of a cell as something that a view uses to draw a portion of the view's contents, and to handle certain events.

The reason that cells exist, is that views are somewhat heavyweight.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜