首页 > Web开发 > 详细

JS调用OC方法

时间:2015-08-14 18:46:15      阅读:348      评论:0      收藏:0      [点我收藏+]

- (void)myMethod:(CDVInvokedUrlCommand*)command

{

    NSString* echo = [command.arguments objectAtIndex:0];

     NSLog(@"%@",echo);

 

     POSJiaoyiViewController *sele=[[POSJiaoyiViewController alloc] init];

     [self.viewController.navigationController pushViewController:sele animated:YES];

     

     userDefaults=[NSUserDefaults standardUserDefaults];

 

    if (echo != nil && [echo length] > 0) {

        [self.commandDelegate runInBackground:^{

            CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];

            [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];

        }];

    } else {

        [self.commandDelegate runInBackground:^{

            CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Arg was null"];

            [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];

        }];

    }

}

JS调用OC方法

原文:http://www.cnblogs.com/dengchaojie/p/4730639.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!