Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取nsstring中的js复选框标签值_Javascript_Ios_Objective C_Iphone_Uiwebview - Fatal编程技术网

Javascript 获取nsstring中的js复选框标签值

Javascript 获取nsstring中的js复选框标签值,javascript,ios,objective-c,iphone,uiwebview,Javascript,Ios,Objective C,Iphone,Uiwebview,我已使用以下代码在uiwebview中成功创建了js复选框: - (void)viewDidLoad { [super viewDidLoad]; //---------------- UITapGesture on UIWebView----------------------- UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:

我已使用以下代码在uiwebview中成功创建了js复选框:

- (void)viewDidLoad {
    [super viewDidLoad];
    //---------------- UITapGesture on UIWebView-----------------------
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(detectTapGesture:)];
    tapGesture.numberOfTapsRequired = 1;
    tapGesture.delegate = self;
    [self.webview addGestureRecognizer:tapGesture];


    array = [[NSMutableArray alloc]initWithObjects:@"'Sudhaadagdudgdada'",@"'qwertyuiopo'",@"'asdfghjkl'", nil];
        NSString *html = [NSString stringWithFormat:@"<div id='check'></div><script> var j; var jsArray = new Array %@; str=''; for(j = 0; j< 3;  j++){ str += '<label><input type=\"radio\" style=\"padding:25px;border-radius:35px;\" id=\"one_'+j+'\" name = \"Sudha\" value = \"'+jsArray[j]+'\" onclick=\"showvalue(this.value);\" />'+jsArray[j]+'</input><br/><br/>'; } document.getElementById(\"check\").innerHTML=str; </script>",array];
    NSLog(@"html..%@",html);

        [self.webview loadHTMLString:html baseURL:nil];

}

请帮助我获取NSString中的复选框值。是否有其他方法从我接触过的uiwebview或其他任何内容获取文本。提前感谢。

为什么要将webview带到这里?创建自己的复选框样式视图并使用它…&我之所以使用uiwebview,是因为所有数据都是以HTML格式从服务器获取的。这就是为什么我没有使用可用的控制不确定,但我认为你所做的是错误的。您可以调用Web服务来显示复选框选项。。。在webview中操作是糟糕的设计。。。
#pragma mark Tap Gesture MEthod
- (void) detectTapGesture:(UITapGestureRecognizer *)gestureRecognizer {

    NSString *result = [self.webview stringByEvaluatingJavaScriptFromString:
                        @"function showvalue(data)  {alert(data);return data;} showvalue(data) "]; //try 2
    NSLog(@"result..%@",result);

}