• 将一个行数在主线程执行的4中方法


     1-GCDblockblock

    dispatch_async(dispatch_get_main_queue(), ^{

    });

    2-NSOperation

    NSOperationQueue *mainQueue = [NSOperationQueue

    mainQueue];

    NSBlockOperation *operation = [NSBlockOperation

    blockOperationWithBlock:^{

    }];

    [mainQueue addOperation:operation];

    3-NSThread

    [selfperformSelector:@selector(method)

    onThread:[NSThread mainThread] withObject:nilwaitUntilDone:YESmodes:nil];

    [selfperformSelectorOnMainThread:@selector(method)

    withObject:nilwaitUntilDone:YES];

    [[NSThread mainThread] performSelector:

    @selector(method) withObject:nil];

    4-RunLoop

    [selfperformSelectorOnMainThread:@selector(method)

    withObject:nilwaitUntilDone:YES];

    [[NSThread mainThread] performSelector:

    @selector(method) withObject:nil];

    • RunLoop

    [[NSRunLoop mainRunLoop] performSelector:@selector(method) withObject:nil];

  • 相关阅读:
    ubuntu装openssh-client和openssh-server
    路由器开源系统openwrt配置页面定制
    linux 串口接收
    SHA算法
    密码学Hash函数
    椭圆曲线加密
    ElGamal密码
    Diffie-Hellman密钥交换
    RSA加密
    公钥密码学
  • 原文地址:https://www.cnblogs.com/CJH5209/p/6072149.html
Copyright © 2020-2023  润新知