
注意事项:
1 只能调用静态方法
2 runtime-src/proj.ios_mac/ios下面添加.m源文件
3 连接苹果手机和直接用mac测试都可以。
举例 添加: Student.h 和 Student.m
代码分别如下:
#import <Foundation/Foundation.h>@interface Student : NSObject{}+(voID) justTest;@end #import "Student.h"@implementation Student+(voID) justTest{ NSLog(@"ok,Js call oc");}@end cocos2d Js中调用的方式为: @H_301_20@Jsb.reflection.callStaticmethod("Student","justTest"); 总结
以上是内存溢出为你收集整理的cocos2d js 调用object-c 方法全部内容,希望文章能够帮你解决cocos2d js 调用object-c 方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)