2

I have code that invalidates the layout of a UICollectionView. I want to wait until the layout has updated before executing some code.

Does the layout get updated in the main queue? And if so, dispatching my code to the main queue would ensure it's executed after, correct? This doesn't seem to be the case however, as my code does appear to be executed beforehand.

4

1 回答 1

2

[self performSelector:@selector(someMethod) withObject:objectOrNil afterDelay:0.0f]; 可能会帮助你。在延迟 0.0 秒后使用您要执行的代码调用方法将等到当前运行周期结束,它不会运行它被调用的那个实例。

于 2013-05-11T17:55:31.317 回答