2014-11-24 71 views
0

我有一個webview和我使用自定義字體(都在web視圖和本地控件)。 但是,當我打開HTML下拉字體呈現的是iOS默認字體。 爲了解釋這更好的,html元素有這樣的事情:UIWebView選擇元素選項字體

<select style="font-family:myfont"> 
    <option value="1">option 1</option> 
    <option value="2">option 2</option> 
    <option value="3">option 3</option> 
    <option value="4">option 4</option> 
</select> 

當降元件被點擊的網頁視圖中打開本地UIPopoverController與包含值的表。該表具有默認字體。

我該如何改變它?

我已經嘗試使用外觀代理,它不受支持。

[[UILabel appearance] setFont:[UIFont fontWithName:kFont_Regular size:18.0]]; 

這裏的問題是,我沒有一個tableview可以實現「cellForRowAtIndexPath」方法。我可以重寫該控件嗎?

有沒有一種方法來設置全局使用的默認UITableViewCell?

在此先感謝。

回答

1

不幸的是,目前還沒有辦法在全球範圍內做到這一點。我必須在cellForRowAtIndexPath方法中執行如下操作。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *simpleTableIdentifier = @"SimpleTableCell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; 

    if (cell == nil) { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; 
     [cell.textLabel setFont:[UIFont fontWithName:@"My_FontName" size:17]]; 
    } 

... 
}