26
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

メインスレッドで処理を実行したい

Posted at

iOSアプリ開発においてUIの更新処理などはメインスレッドで行わなければならないですが、
させたい処理をわざわざメソッドで作って、セレクタで指定して呼ぶ、という流れはなかなか面倒くさい。
GDC(マルチスレッド処理が簡単にできるようになる機能)を使用すると簡潔に書けます。

Demo.m
// Viewの更新はメインスレッドで実行
dispatch_async(dispatch_get_main_queue(), ^{
    [self.tableView reloadData];
});
26
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?