如何连接“文件的所有者";使用工具栏中的按钮? [英] How can I connect "File's Owner" with a button in a Toolbar?

查看:34
本文介绍了如何连接“文件的所有者";使用工具栏中的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是疯狂地将文件的所有者"连接到工具栏中的按钮.我该怎么办?

I just got crazy with connecting the "File's Owner" to a Button in my Toolbar. How do I do that?

我只能抓住工具栏,而不能抓住里面的按钮.我该怎么解决?

I only can grab the Toolbar but not the buttons inside. How can I solve that?

推荐答案

对于示例iPhone应用程序,创建与UIButton(IBOutlet)的连接以便可以对UIButton进行更改的过程如下:

For a sample iPhone application the process of creating a connection to a UIButton (IBOutlet) so that you can make changes to the UIButton goes like this:

myClass.h

#import <Cocoa/Cocoa.h>

@interface myClass {

    UIButton *myButton;
}

@property (retain) IBOutlet UIButton *myButton;

@end

myClass.m

#import "myClass.h"

@implementation myClass

@synthesize myButton;

@end

然后在Interface Builder中打开XIB文件并按住Control,将鼠标从界面中的UIButton拖动到IB中 Document窗口(Command + 0)中的File Owner对象.然后选择IBOutlet.

Then open your XIB file in Interface Builder and press and hold Control, the drag the mouse from the UIButton in your interface to the File's Owner object in the Document window (Command+0) in IB. Then choose the IBOutlet.

要使通常在拖动时看到的插座,需要先构建项目,然后再进入Interface Builder,然后再检查一下您所创建的IBOutlet的类类型是否正确.

For the Outlet to be seen when you drag normally requires that you build the project before going into Interface Builder, and yes secondly check that you have the class type for the IBOutlet that you created is correct.

这篇关于如何连接“文件的所有者";使用工具栏中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆