dispatch_after中时间的计算
dispatch_after中用的时间是纳秒,所以需要进行转换:desDelayInSeconds(目标时间,比如2s)* NSEC_PER_SEC
double delayInSeconds = 0.3; // 创建延期的时间 0.3S,因为dispatch_time使用的时间是纳秒,尼玛,比毫秒还小,太夸张了!!! dispatch_time_t delayInNanoSeconds =dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); dispatch_queue_t mainQueue = dispatch_get_main_queue(); // 延期执行 dispatch_after(delayInNanoSeconds, mainQueue, ^(void){ [UIView animateWithDuration:0.3 animations:^{ CGRect rect = self.postBtnBigRect; rect.origin.x = 0; self.topView.frame = rect; }]; });