
我分类一个UItableVIEwheaderfooterVIEw并想要@R_138_6502@大小:
- (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中再次@R_138_6502@大小,字体就会变得正确.
它让我疯狂!!!
而我做同样的字体改变,当子类的细胞,它的工作正常!任何人都可以告诉我发生了什么?谢谢!
这是日志:
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.00pt2014-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.00pt2014-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.00pt2014-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.00pt2014-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.00pt2014-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解决方法 它似乎不是放置它的正确的地方,但您可以更改您的UItableVIEwheaderfooterVIEw子类的layoutSubvIEws方法中的字体,它将适用.
- (voID)layoutSubvIEws { [super layoutSubvIEws]; // Font self.textLabel.Font = [UIFont systemFontOfSize:20];} 总结 以上是内存溢出为你收集整理的ios – 在UITableViewHeaderFooterView中更改字体大小的麻烦全部内容,希望文章能够帮你解决ios – 在UITableViewHeaderFooterView中更改字体大小的麻烦所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)