scaledValueForValue: called on a font that doesn't have a text style set

前端 未结 8 2058
暗喜
暗喜 2020-12-24 01:46

I am currently using the Xcode 6 pre release (not beta) and the simulator on OS X 10.10 Yosemite beta 7. I am trying to build a project developed in xcode 6, but the app cra

8条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 02:02

    Same problem here: set a custom font for UITableViewHeaderFooterView in my app init, get this crash when showing a grouped UITableView.

    What works for me is to delay customisation until the view controller is being created, i.e. do whatever you would have done at app init in the view controller's init. Irritating, but works for me.

    - (id) init
    {
      ...
    
      if (self = [super init])
      {
        // customise table view headers
        UILabel *headerLabel =
          [UILabel appearanceWhenContainedIn: [UITableViewHeaderFooterView class], nil];
    
        headerLabel.font =
          [UIFont fontWithName: @"AvenirNext-Medium" size: 15];
    
        ...
      }
    }
    

提交回复
热议问题