<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## @NSThread的使用 ### 1.顯示調用的類為NSThread有兩種直接創建方式: **- (id)initWithTarget:(id)target?selector:(SEL)selector?object:(id)argument(手動開啟)** **+ (void)detachNewThreadSelector:(SEL)aSelector?toTarget:(id)aTarget?withObject:(id)anArgument(自動開啟)** ~~~ 1、[NSThread detachNewThreadSelector:@selector(doSomething:) toTarget:self withObject:nil]; 2、NSThread* myThread = [[NSThread alloc] initWithTarget:self selector:@selector(doSomething:) object:nil]; [myThread start]; ~~~ ### 2\. 不顯式創建線程的方法: **通過NSObject的Category方法調用:** **- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait;?//在主線程中運行方法,wait表示是否阻塞這個方法的調用,如果為YES則等待主線程中運行方法結束。一般可用于在子線程中調用UI方法。** **- (void)performSelector:(SEL)aSelector onThread:(NSThread *)thread withObject:(id)arg waitUntilDone:(BOOL)wait;**?//**在指定線程中執行,但該線程必須具備run loop。** **- (void)performSelectorInBackground:(SEL)aSelector withObject:(id)arg;**?//產生新線程。 **3.NSThread的其它一些常用的方法** **1.?+ (NSThread?*)currentThread;?//獲得當前線程** **2.?+ (void)sleepForTimeInterval:(NSTimeInterval)ti;?//線程休眠** **3.?+ (NSThread *)mainThread;?//主線程,亦即UI線程了** **4.?- (BOOL)isMainThread;?+ (BOOL)isMainThread;?//當前線程是否主線程** **5.?- (BOOL)isExecuting;?//線程是否正在運行** **6.?- (BOOL)isFinished;?//線程是否已結束** **7.- (void)cancel ?//?終止線程循環** **8.- (void)start ?// 開啟線程循環**
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看