猿问
下载APP

在iOS平台中怎样使用c++和objective

在iOS平台中怎样使用c++和objective


翻过高山走不出你
浏览 272回答 1
1回答

BIG阳

解决方案1:from C++, only if the selector list will have a method  /:~HelloWorld()  {  /:(NSBundle *)nibBundleOrNil {  if ((self = [super initWithNibName:nibNameOrNil bundle; Show a bogus pop up here  UIAlertView *message = [[UIAlertView alloc] initWithTitle;):nibBundleOrNil])) {  /to_be_called"/:nil];/ Making parameters for message to be passed to native language  /, ":;); Coming from C++  [IOSNDKHelper SetNDKReciever; with the string we are passing  [IOSNDKHelper SendMessage:menuCloseCallback(CCObject* pSender)  {  /:;  // Register a selector in a global space  / For the ease of use; Custom initialization  / Be sure to name the selector to be of the same string as you will pass from C++  //purchase something called",我已经创建了一个网络存储库:@"/SampleSelector"to_be_called"/:;OK"/ Fetching the name of the method to be called from Native to C++ 23 /;  NSLog(@"Passed params are :@" It can respond to the selector  /, parameters); Send C++ a message with paramerts  /!"  //:AddSelector("SampleSelector"  prms->//This is a sample popup on iOS" Because we are destroying this instance  NDKHelper;);/:nil  cancelButtonTitle;/  }  /Hello World;/, i am sending the method to be called name from C++  CCDictionary* prms = CCDictionary;  message;/  }  return self,我必须向Objective-C发送消息来显示本地(本来的系统中)的弹框; For a ease of use;);  }  /。以下是网络存储库的链接:; Note :create(":self];///:; Remove the associated selector group from the global space,  " Implement the selector to be called for a message from C++ 14///.h"  目的  当Cocos2dx场景中一个按钮被点击;  [message show];  /:。请确保你引用了所有的C++和Objective-C文件; Using a UIViewController init method to attach a receiver for messages from C++  - (id)initWithNibName, that is why created this selector  - (void) SampleSelector; Finally call the native method in current environment  SendMessageWithParams(string(":SampleSelector(CCNode *sender:@"/:SampleSelector);  /:(NSObject *)prms  {  NSLog(@");/,  /  /:@" Destructor to remove all the selectors which are grouped as HelloWorldSelectors 31HelloWorld;  }  Objective-C  /  }  / Tell NDKHelper that RootViewController will respond to messages  /, when native language will call it  void HelloWorld; A selector that will respond to us; So that when our native environment will call the method with the string  /,  callfuncND_selector(HelloWorld,并根据环境不同将其分开, prms):nil]: Group name is there for ease of removing the selectors  NDKHelper;];  delegate;//: %@":CPPFunctionToBeCalled WithParameters:;/ Like we passed "NDKHelper:(NSString *)nibNameOrNil bundle;SampleSelector",  this); C++ will recieve this message;), i have passed the name of method from C++  NSString* CPPFunctionToBeCalled = (NSString*)[parameters objectForKey:;HelloWorldSelectors"Called from native environment"  /setObject(CCString; The button click method of Cocos2dx  void HelloWorld;SampleSelector"  otherButtonTitles:RemoveSelectorsInGroup("HelloWorldSelectors"  NSDictionary *parameters = (NSDictionary*)prms:create();/, void *data)  {  CCLog("。让我们找到如何实现它:  EasyNDK  C++  #include "。  包含  你需要在你的项目中引用若干个文件
打开App,查看更多内容
随时随地看视频慕课网APP
我要回答