【发布时间】:2015-02-10 08:13:09
【问题描述】:
我有一个这样声明的属性:
@property (nonatomic, strong) UIScrollView *scroll;
然后我在 viewDidLoad:
// Create scrollview
_scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
// Function to add more view to _scroll
[self addStuff];
// This line makes things expensive on memory
[self.view addSubview:_scroll];
// Then if the above line is not commented out the view push lags
AViewController *aView = [[AViewController alloc] init];
[self.navigationController pushViewController:aView animated:YES];
如何保持强大以在我的其他功能上使用但防止推送滞后?
【问题讨论】:
-
你是什么意思滞后?从
viewDidLoad推送是个坏主意。视图没有完成正确的布局。你需要嵌入AViewController? -
同意。在
viewDidAppear:之前避免调用pushViewController:。viewDidLoad太早了。你还没有出现在屏幕上。
标签: ios uiviewcontroller uiscrollview ios8 uiview-hierarchy