开发者

Can anybody explain about how I set Global Button's target in Objective-C?

If I wrote program in class (use @interface ....in .h and @implementation in .m) I can set button:target to self but if I want to use in global function, I cannot开发者_JS百科 set button:target as self. I got the error as self"undeclared".

I want to set the target as UIWindow or current display's view.

Can anybody help?


A target has to be an object, and an action has to be a method on that object. You can't do what you're trying to do.

If there's some pressing need for a global instance of something, consider making a singleton object and using that as your target.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜