简体   繁体   中英

Change UITableViewCell Font in iOS 8 and swift

I'm trying to change the font for my uitableviewcells,

I'm trying to use this at the moment with not success:

cell.textLabel.font = [UIFont .preferredFontForTextStyle("Avenir")];

Now i've read a lot on this and it seems I should use this instead :

    cell.textLabel.font = [UIFont fontWithName: "Avenir" size:22];

Problem is fontWithName does not seem to exist in iOS 8

any ideas??

thanks

The thing is that this is not Swift (it is a kind of horrifying bastardization of Objective-C):

cell.textLabel.font = [UIFont fontWithName: "Avenir" size:22];

This would be Swift:

cell.textLabel.font = UIFont(name:"Avenir", size:22)

尝试以下铸造方式:

cell.textLabel.font = UIFont(name: "Avenir", size:22);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM