代码之家  ›  专栏  ›  技术社区  ›  suse

如何使handler方法在Objective-C中首先运行

  •  0
  • suse  · 技术社区  · 14 年前

    在下面单个对象的方法调用中,如何使handler方法先运行,然后再运行Objective-C中的main方法?

    主方法:AuthenticateMobileServer

    handler方法:handler

    [mobile_Obj authenticateMobileServer:self action:@selector(handler:)];  
    

    谢谢您。

    1 回复  |  直到 14 年前
        1
  •  0
  •   V1ru8    14 年前

    http://developer.apple.com/mac/library/documentation/cocoa/conceptual/objectivec/articles/ocLanguageSummary.html ) (方法名和变量名是小写的!只有类名是大写的) [mobileObj authenticateMobileServer:self action:@selector(handler:)]

    authenticateMobileServer:action: 只执行该方法。 @selector(handler:) 只是一个函数指针。