0
UIWebView
을 UIAlertView
에 성공적으로 추가하고 경고 팝업에 Html 페이지를 표시했습니다. 하지만 이제는 UIWebView
에있는 요소를 추적하고 싶습니다. 제발 어떻게 UIButton
을 클릭하면 UIWebView
에 클릭하면 alert
팝업 창이 표시되는지 알 수 있습니까?UIAlertView iOS에 UIWebView 추가하기
코드 :
NSString *html [email protected]"<!DOCTYPE html><html><body><form action=\"action_page.php\">First name:<br><input type=\"text\" name=\"firstname\"><br> Last name:<br> <input type=\"text\" name=\"lastname\"><br><br> <input type=\"submit\"> </form> <p>Note that the form itself is not visible.</p> <p>Also note that the default width of a text field is 20 characters.</p> </body> </html>";
UIWebView *webView = [[UIWebView alloc] init];
[webView setFrame:CGRectMake(0,0,200,400)];
NSData *data = [html dataUsingEncoding:NSUTF8StringEncoding];
[webView loadData:data MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@"www.google.com"]];
webView.delegate = self;
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"TEST" message:@"subview" delegate:nil cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
[av setValue:webView forKey:@"accessoryView"];
[av show];
를 @ "TEST"메시지 @ "하위 뷰" delegate : nil cancelButtonTitle : @ "NO"otherButtonTitles : @ "YES", nil]; [av setValue : webView forKey : @ "accessoryView"]; [av show]; – Sumit
예, UIviewWeb에 현재보기에 위임자를 지정할 수 있습니다. – Esha
질문에 동일한 코드를 추가하여 더 명확하게하십시오. delegate를'webView.delegate = self'로 설정하고 webview에 대한 프로토콜을 추가 할 수 있습니다. 귀하의 클릭 이벤트를 해결할 수 있습니다. – Esha