warning: incompatible Objective-C types
Warning: incompatible Objective-C types 'struct NSArray *', expected 'struct UIFont *' when passing argument 1 of 'setFont:' from distinct Objective-C type
Code Like:
lblTemp.font = [UIFont fontNamesForFamilyName:@"Arial"]; // Warning comes here
lblTemp.font = [UIFont fontWithName:@"Arial-BoldMT开发者_运维问答" size:13];
[cell.contentView addSubview:lblTemp];
[lblTemp release];
Please give some suggestion to solve to it.
-fontNamesForFamilyName:
returns an array of font names, not a UIFont
. You'll want to pass one of the strings in this array to +[UIFont fontWithName:size:]
to get a UIFont
object back (as you do in the next line).
[UIFont fontNamesForFamilyName:@"Arial"];does not return the Arial font, it returns the array of font names for the Arial font family. Check the manual here
精彩评论