包含大量元素的自定义segued视图

时间:2016-03-23 10:37:25

标签: objective-c uiviewcontroller uistoryboardsegue xcode-storyboard

当我在iPad 3上触发我的CatalogController时(在模拟器中需要不到一秒钟,但这不相关):

- (IBAction)goToCatalog:(id)sender {
    NSLog(@"goToCatalogPre");
    [self presentViewController:[[UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil] instantiateViewControllerWithIdentifier:@"CatalogController"] animated:YES completion:nil];
    NSLog(@"goToCatalogPost");
}

我得到了这个结果:

2016-03-23 11:27:07.245 Fashion App[592:78778] goToCatalogPre
2016-03-23 11:27:13.571 Fashion App[592:78778] goToCatalogPost

这是一个艰难的6.25秒。我从头到尾测试了viewDidLoad,字面上需要几纳秒。除了这个电话之外别无其他任何动机。

我将这些代理附加到我的ViewController:

@interface CatalogController : CoreController <UICollectionViewDelegate, UICollectionViewDataSource, UISearchBarDelegate, UIPickerViewDelegate, UIPickerViewDataSource>

CoreController只进行一次变量跟踪,因此不会缓慢。

任何人都有可能导致这种异常的经历吗?老实说,我可以解构所有元素以追溯它,但我想知道是否有人可能曾经遇到过这种情况,可能会导致它或其他我可以追踪它的地方而不是viewDidLoad电话。

以下是此视图中我的故事板中的元素:

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:2)

我使用了Time Profiler,它实际上是在引擎盖下发生的。在某些时候它会击中一个UIButton(总运行时间的69%),然后更深层次的TBaseFont:CopyLocalizedName(__ CFString const *)并从那里分成33%和22%(和一些其余的)到一些本地化cache和TBaseFont :: CopyNativeFont()const。猜猜我将不得不关注所有按钮,看看哪一个可能导致这种情况。

经过一些跟踪后,我发现(通过这个答案:Xib taking long time (>1s) to load. UIFont cache seems to blame)这是一个旧的遗漏字体错误。它试图加载一个旧的Lucida Grande变种,它似乎停止缓存使它吓坏了。纠正字体再次成为系统修复它。加载时间只是几毫秒。

相关问题