<divid="btnIOS">iOS로 callbackToiOSFromJavaScript 호출하기</div><script>$('#btnIOS').click(function(){callbackToiOSFromJavaScript('"JavaScript" ==> "iOS" 로 이 메세지를 보냄!!!');});</script>
3. iOS 에서 JavaScript Function 을 호출해 보기.
ViewController.m : 44라인
-(IBAction)clickedSendButton:(id)sender{NSString*jscbString=[NSStringstringWithFormat:@"commandFromiOSToJavaScript('first', 'second')"];NSLog(@"------> jscbString : [%@]",jscbString);NSString*result=[_webViewstringByEvaluatingJavaScriptFromString:jscbString];NSLog(@"------> result : [%@]",result);}
test.html : 16, 28라인
<divid="divIOS"></div><script>vardivIOS=$('#divIOS');functioncommandFromiOSToJavaScript(firstArg,secondArg){divIOS.html(divIOS.html()+'First Arg : '+firstArg+', Second Arg : '+secondArg+'<br />');return'ok!'}</script>
2017-07-09 01:26:25.610 WebViewTest001[82455:666602] log message: === Java Script Start===>2017-07-09 01:26:25.612 WebViewTest001[82455:666602] log message: <=== Java Script End===2017-07-09 01:27:06.315 WebViewTest001[82455:666562] ------> jscbString : [commandFromiOSToJavaScript('first', 'second')]2017-07-09 01:27:06.317 WebViewTest001[82455:666562] ------> result : [ok!]2017-07-09 01:27:07.508 WebViewTest001[82455:666562] ------> jscbString : [commandFromiOSToJavaScript('first', 'second')]2017-07-09 01:27:07.509 WebViewTest001[82455:666562] ------> result : [ok!]2017-07-09 01:27:08.869 WebViewTest001[82455:666562] ------> jscbString : [commandFromiOSToJavaScript('first', 'second')]2017-07-09 01:27:08.871 WebViewTest001[82455:666562] ------> result : [ok!]2017-07-09 01:27:11.008 WebViewTest001[82455:666562] ------> jscbString : [commandFromiOSToJavaScript('first', 'second')]2017-07-09 01:27:11.009 WebViewTest001[82455:666562] ------> result : [ok!]2017-07-09 01:27:30.969 WebViewTest001[82455:666602] : "JavaScript"==> "iOS" 로 이 메세지를 보냄!!!2017-07-09 01:27:32.329 WebViewTest001[82455:666602] : "JavaScript"==> "iOS" 로 이 메세지를 보냄!!!2017-07-09 01:27:33.532 WebViewTest001[82455:666602] : "JavaScript"==> "iOS" 로 이 메세지를 보냄!!!2017-07-09 01:27:34.855 WebViewTest001[82455:666602] : "JavaScript"==> "iOS" 로 이 메세지를 보냄!!!
참고 On-Demand Resources Guide UITableView Performance URL : A Closer Look at Table View Cells Cells and Table View Performance The proper use of table view cells, whether off-the-shelf or custom cell objects, is a major factor in the performance of table views. Ensure that your application does the following three things: Reuse cells. Object allocation has a performance cost, especially if the allocation has to happen repeatedly over a short period—say, when the user scrolls a table view. If you reuse cells...