iPhone +来自其他类的访问控制
我有课程: PropertyCalcViewController
.m & .h
在 .h 我有
IBOutlet UIButton *btnGo;
@property (nonatomic, retain) IBOutlet UIButton *btnGo;
,在 .m 文件我有
@synthesize *btnGo;
现在我还有另一个类 Manager
.m & .h.
我想要做的是从 Manager
类访问 btnGo
并将其从 PropertyCalcViewController
中删除,就像
[btnGo removeFromSuperView]
我该怎么做?
I have classes: PropertyCalcViewController
.m & .h
In the .h I have
IBOutlet UIButton *btnGo;
@property (nonatomic, retain) IBOutlet UIButton *btnGo;
and in the .m file I have
@synthesize *btnGo;
Now I also have another class Manager
.m & .h.
What I want to do is that access btnGo
from the Manager
class and remove it from PropertyCalcViewController
like
[btnGo removeFromSuperView]
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要访问属性,您可以使用“点语法”:
另外,我相信您的意思是
@synthesize btnGo;
,而不是@synthesize *btnGo;
这是一种语法-错误。To access a property, you use the "dot-syntax":
Also, I believe you mean
@synthesize btnGo;
, instead of@synthesize *btnGo;
which is a syntax-error.确保 btnGo 已在 Interface Builder 中正确链接。简单但常见的监督。
Insure that btnGo has been properly linked up in Interface Builder. Simple but common oversight.