OC dispatch_after
__weak typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^
{
__strong typeof(self) pThis = weakSelf;
[pThis.backgroundView removeFromSuperview];
pThis.backgroundView = nil;
});
Swift DispatchQueue.main.asyncAfte
DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute:
{
self.backgroundView()?.removeFromSuperview()
self.setBackgroundView(backgroundView: nil)
})
强烈推荐:超简单!!! iOS设置状态栏、导航栏按钮、标题、颜色、透明度,偏移等
https://github.com/wangrui460/WRNavigationBar
https://github.com/wangrui460/WRNavigationBar_swift
欢迎关注我的微博:wangrui460
网友评论