JavaScipt を介してロードされた Web ページのタイトルを取得し、それを UIActionSheet のタイトルとして配置しようとしています。
現在ViewController.mにあるもの:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSString *webTitle = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
- (IBAction)showActionSheet:(id)sender {
// webTitle.text receives errors
UIActionSheet *actionsheet = [[UIActionSheet alloc]initWithTitle:webTitle delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Share...", @"Bookmarks", @"Read Later", @"Add to Bookmarks", @"Settings", nil];
actionsheet.actionSheetStyle = UIBarStyleBlackTranslucent;
[actionsheet showInView:self.view];
NSLog(@"Action Menu opened");
}
編集: これらの警告も受け取っています。
EDIT2: JavaScript アラートによるコードの評価は正常に機能します。