开发者

How to make controls "tabable" when loaded from plugin in Cocoa app?

I have an application thad loads in plugins that have their own UI. There is an IBOutlet called ContainerView in my AppDelegate. When the plugin loads, it puts its own view (that is stored in a xib in the plugin bundle) into the Container view like so

[ContainerView addSubview:viewFromPlugin];

When the view loads, everything is fine but when I press tab the only controls that get any focus are ones outside of the ContainerView and none of them inside it get focus.

I've tried setting the 开发者_运维百科container view as the initialFirstResponder and I've tried hooking up the nextKeyView from the last button in the tab order to the ContainerView.

Thanks.


I've tried setting the container view as the initialFirstResponder and I've tried hooking up the nextKeyView from the last button in the tab order to the ContainerView.

Is that what you want to do? Make the container view the key view? It doesn't sound like it; it sounds like you want the plug-in view (or a view within it) to become the key view.

This section of the Apple documentation explains all of the different aspects of the key view loop. I believe you'll want to either set the nextKeyView of the container view as well as the view before it, or override the container view's nextValidKeyView method—possibly both. You might also try setting the previous view's nextKeyView directly to the plug-in view's nextValidKeyView, skipping over the container view entirely.


Did you try calling the becomeFirstResponder method on your ContainerView?

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/becomeFirstResponder

UIView classes inherit from UIResponder.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜