大佬教程收集整理的这篇文章主要介绍了ios – 在UITableViewHeaderFooterView中更改字体大小的麻烦,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我分类一个UITableViewHeaderFooterView并想要更改字体大小:
- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code self.textLabel.textColor = [UIColor colorWithWhite:0.8 alpha:1.0]; //the font is not working self.textLabel.font = [UIFont systemFontOfSize:20]; NSLog(@"aaa%@",self.textLabel.font); } return self; }
颜色的东西工作正常,但字体没有改变,所以我记录出队:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UITableViewHeader *headerView = [self.tableView dequeueReusableHeaderFooterViewWithIdentifier:MWDrawerHeaderReusEIDentifier]; headerView.textLabel.text = self.sectiontitles[@(section)]; NSLog(@"bbb%@",headerView.textLabel.font); return headerView; }
字体仍然在这里,所以我登录didLayoutsubviews:
-(void)viewDidLayoutSubviews { UITableViewHeaderFooterView *head = [self.tableView headerViewForSection:0]; NSLog(@"ccc%@",head.textLabel.font); }
并且字体大小神奇地更改回到默认值!但是我没有做任何事情,如果我在viewDidLayoutSubviews中再次更改字体大小,字体就会变得正确.
它让我疯狂!!!
而我做同样的字体改变,当子类的细胞,它的工作正常!任何人都可以告诉我发生了什么?谢谢!
这是日志:
2014-02-09 16:02:03.339 InternWell[33359:70b] aaa<UICTFont: 0x8da4290> font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 20.00pt 2014-02-09 16:02:03.339 InternWell[33359:70b] bbb<UICTFont: 0x8da4290> font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 20.00pt 2014-02-09 16:02:03.341 InternWell[33359:70b] aaa<UICTFont: 0x8da4290> font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 20.00pt 2014-02-09 16:02:03.342 InternWell[33359:70b] bbb<UICTFont: 0x8da4290> font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 20.00pt 2014-02-09 16:02:03.343 InternWell[33359:70b] ccc<UICTFont: 0x8d22650> font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 14.00pt 2014-02-09 16:02:03.343 InternWell[33359:70b] ccc<UICTFont: 0x8d22650> font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 14.00pt
以上是大佬教程为你收集整理的ios – 在UITableViewHeaderFooterView中更改字体大小的麻烦全部内容,希望文章能够帮你解决ios – 在UITableViewHeaderFooterView中更改字体大小的麻烦所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。