UIWebView中的自定义字体

时间:2014-04-12 07:41:54

标签: ios objective-c uiwebview custom-font

您好我实际上尝试在我的UIWebView.Here的代码中使用自定义字体:

  - (void)viewDidLoad
{    [super viewDidLoad];

[_content setBackgroundColor:[UIColor clearColor]];

    NSString* plainContent = _articleContent;

    NSString* _articleContent = [NSString stringWithFormat:
                                   @"<html>"
                                   "<style type=\"text/css\">"
                                 "body { background-color:transparent; font-family:Helvetica Neue;font-weight: lighter;font-size:16;color: #708090;}"
                                   "</style>"
                                   "<body>"
                                   "<p>%@</p>"
                                   "</body></html>", plainContent];

    [_content loadHTMLString:_articleContent baseURL:nil];
}

加载Web视图时,这工作实际上很棒(这里是代码:)

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([[segue identifier] isEqualToString:@"homeSegue"]) {
        NSIndexPath *indexPath = [_tableView indexPathForSelectedRow];

        NSDictionary *posts = [_tableData objectAtIndex:indexPath.row];
        NSString *title    = [posts valueForKey:@"title"];
        NSString *date     = [posts valueForKey:@"date"];
        NSString *content  = [posts valueForKey:@"content"];
        NSDictionary *author   = [posts valueForKey:@"author"];
        NSString *authorName   = [author valueForKey:@"name"];
        NSString *url      = [posts valueForKey:@"url"];

        LHDetailViewController *detailVC = (LHDetailViewController *) segue.destinationViewController;

       // [detailVC setArticleAuthor:authorName];
        [detailVC setArticleContent:content];
        [detailVC setArticleDate:date];
        [detailVC setArticleTitle:[title kv_decodeHTMLCharacterEntities]];
        [detailVC setArticleUrl:url];
    }
}

但是在iPad上我使用的是UISplitView,当应用程序启动WebView(位于拆分控制器的详细信息视图中)显示(null)作为内容时,如何删除它? (并保持网络视图为空)。

非常感谢! PS:让我知道我是否需要发布更多代码(我是初学者)。

0 个答案:

没有答案