UILabel の日付を変更する日付ピッカーを使用して、メイン ビュー コントローラーの UIlabel に Date を表示しています。日付に基づいて変化する UIWebViews があります。UILabel に表示された日付を UIWebview に渡すにはどうすればよいですか?
前もって感謝します
UILabel の日付を変更する日付ピッカーを使用して、メイン ビュー コントローラーの UIlabel に Date を表示しています。日付に基づいて変化する UIWebViews があります。UILabel に表示された日付を UIWebview に渡すにはどうすればよいですか?
前もって感謝します
イベントのターゲットとセレクターを追加します: UIControlEventValueChanged そして、単にセレクターから JavaScript 関数を呼び出します。
//set the selector for datePicker event
[datePicker addTarget:self action:@selector(dateChanged) forControlEvents:UIControlEventValueChanged];
.......
.......
-(IBAction)dateChanged
{
.......
.......
//call the javascript function text=>data to show
NSString *string = [NSMutableString stringWithFormat:@"showTextFromNative( %@)", text];
[self.webviewOutlet stringByEvaluatingJavaScriptFromString:string];
}
//javascript function in your html
function showTextFromNative(text)
{
....
....///Do what ever you want to show in webview
....
}