//------------------------------------------------------------------------------
// perform block with delay
//------------------------------------------------------------------------------
+ (void)doPerformBlock:(dispatch_block_t)block withDelay:(NSTimeInterval)delay
{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), block);
}
//------------------------------------------------------------------------------
// 사용법
//------------------------------------------------------------------------------
void (^block)(void) = ^(void)
{
btn.enabled = YES;
};
[LibCommon doPerformBlock:block withDelay:0.5];
반응형
'iOS 초보' 카테고리의 다른 글
2.23리젝 대응 (0) | 2015.05.12 |
---|---|
pdf, horizonal, paging (0) | 2015.05.08 |
status bar 객체 얻기 (0) | 2015.04.07 |
UIActivityViewController, 카카오링크 연동 (0) | 2015.04.03 |
iOS, googlemap, 마커가 모두 보이도록 지도 조정 (0) | 2015.03.30 |