UI 操作と競合しないスレッドによるタイマー表示2012年07月21日 11:22

画面にUIPickerと、NSTimerを使ったタイマーを配置した場合、カウント中にピッカーを回転させるとその間カウンターの表示が停止する。これは、NSTimer、UIViewの表示がともにメインスレッドで動作するからです。
これを回避するには、タイマーのカウント部分を別のスレッドにすることですが、カウンターの更新部分はUI にアクセスすることになる( ...メインスレッドに用意したメソッドを呼び出す)あまりすっきりしない。iOS 4 から導入されたGCDならメインのUI にアクセスできるから扱いやすい。これを直接利用してもよいが、NSOperationQue もGCDが使われるようになっているからこれを使ってテストしてみたが、動作は快適である。

// タイマーの更新(テストコード)
- (void) countUpdate
{
 NSOperationQueue *queue = [[[NSOperationQueue alloc]init] autorelease];
 [queue addOperationWithBlock:^{

  while (1) {
   NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
   [mainQueue addOperationWithBlock:^{
    // カウントアップ
    count_++;
    // 再生時間を更新
    countLabel_.text = [NSString stringWithFormat:@"%d", count_];
   }];
   [NSThread sleepForTimeInterval:1.0f];
  }
 }];
}

参考:
 詳解 iOS 5 プログラミング

コメント

_ shoe-lifts ― 2016年09月10日 22:41

Super-Duper site! I am loving it!! Will be back later to read some more.
I am bookmarking your feeds also

_ heel lifts insoles ― 2016年09月14日 03:42

Hi, i believe that i noticed you visited my website so i came to �go
back the prefer�.I am trying to to find things to enhance my site!I assume its
good enough to make use of a few of your ideas!!

_ become taller naturally ― 2016年09月14日 22:25

Ԍreat weblog here! Additionally your site rather a lot up vewry fast!

What web hօst are yyou the usse of? Cɑn I get your assocіatе
link to your host? I want my site lߋaded ᥙp as quiсkly aas yoսrs lol

_ foot pain ― 2016年09月26日 11:42

Hey, you used to write great, but the last several posts
have been kinda boring? I miss your super writings. Past few posts are
just a little bit out of track! come on!

_ buying running ― 2016年09月28日 23:03

Oh my goodness! Incredible article dude! Thank you so
much, However I am going through problems with your RSS. I don?t understand the reason why I cannot join it.
Is there anybody having similar RSS issues? Anyone who knows the
answer will you kindly respond? Thanx!!

_ healthy feet ― 2016年09月29日 08:40

I was able to find good information from your articles.

_ unusual shoes ― 2016年09月29日 09:42

I must thank you for the efforts you have put in penning
this site. I really hope to check out the same high-grade blog posts from you
later on as well. In truth, your creative writing abilities has inspired me to get
my very own site now ;)

_ prevent yeast ― 2016年10月05日 13:18

Every weekend i used to pay a visit this web page, as i want enjoyment, for the reason that this this site
conations truly nice funny information too.

_ neon denim ― 2016年10月05日 14:18

It is in point of fact a nice and helpful piece of information. I'm satisfied that you
just shared this useful info with us. Please stay us up to date like this.
Thank you for sharing.

_ buying stylish golf ― 2017年01月19日 12:45

Wow, fantastic blog format! How lengthy have you been running a blog for?
you made blogging glance easy. The total glance of your website is magnificent, as neatly as the content![X-N-E-W-L-I-N-S-P-I-N-X]I simply couldn't
leave your website before suggesting that I extremely loved the usual info a person provide on your guests?

Is gonna be again steadily in order to inspect new posts.

_ build muscle mass ― 2017年03月02日 12:02

Hi there to all, how is the whole thing, I think every one is getting
more from this site, and your views are good in support of new people.

_ fastlose weight ― 2017年03月02日 22:21

Hmm it appears like your blog ate my first comment
(it was extremely long) so I guess I'll just sum it up what I
submitted and say, I'm thoroughly enjoying your blog.
I as well am an aspiring blog writer but I'm still new to the whole thing.

Do you have any tips and hints for rookie blog writers?
I'd really appreciate it.

_ no credit check student loans ― 2017年03月05日 03:29

Great article. I'm dealing with many of these issues
as well..

_ manicure ― 2017年03月21日 18:55

Its like you read my mind! You seem to know a lot about this,
like you wrote the book in it or something. I think that you can do with
a few pics to drive the message home a bit, but instead of that,
this is great blog. An excellent read. I will certainly be
back.

_ manicure ― 2017年03月30日 20:12

Hi everyone, it's my first visit at this site, and post is genuinely fruitful
for me, keep up posting these content.

_ manicure ― 2017年03月30日 20:19

I'm amazed, I have to admit. Rarely do I encounter a
blog that's equally educative and amusing, and let me
tell you, you have hit the nail on the head.
The issue is something not enough people are speaking intelligently about.
I am very happy that I came across this in my hunt for something concerning this.

_ manicure ― 2017年03月30日 20:31

Hi there, I discovered your site by way of Google even as looking for a
related matter, your web site came up, it seems to be great.

I have bookmarked it in my google bookmarks.
Hi there, just became alert to your blog via Google, and found that it's really informative.
I am gonna watch out for brussels. I will appreciate if you happen to proceed this in future.
A lot of other people can be benefited out of your writing.
Cheers!

_ manicure ― 2017年03月30日 20:38

fantastic publish, very informative. I'm wondering why the opposite specialists of this
sector do not notice this. You should continue your writing.

I'm confident, you have a great readers' base already!

_ manicure ― 2017年03月30日 20:48

What a stuff of un-ambiguity and preserveness of precious know-how about unpredicted emotions.

_ manicure ― 2017年03月30日 20:59

Hello friends, how is everything, and what
you would like to say regarding this paragraph, in my view its genuinely awesome designed
for me.

_ manicure ― 2017年03月30日 21:10

I'm really enjoying the design and layout of your blog.

It's a very easy on the eyes which makes it much more enjoyable for
me to come here and visit more often. Did you hire out a designer to create your theme?
Superb work!

_ manicure ― 2017年03月30日 21:12

Howdy! I know this is kinda off topic but I'd figured
I'd ask. Would you be interested in trading links or maybe guest
writing a blog article or vice-versa? My blog covers a lot of the same subjects as
yours and I think we could greatly benefit from each
other. If you happen to be interested feel free to send me an email.
I look forward to hearing from you! Excellent blog by the way!

_ manicure ― 2017年03月30日 21:22

Hmm it looks like your blog ate my first comment (it
was extremely long) so I guess I'll just sum it up what I submitted
and say, I'm thoroughly enjoying your blog. I too am an aspiring blog blogger but I'm
still new to everything. Do you have any recommendations for newbie blog writers?
I'd genuinely appreciate it.

_ manicure ― 2017年03月30日 21:28

That is really interesting, You're a very skilled blogger.
I have joined your feed and stay up for seeking more of
your great post. Also, I've shared your web site in my social networks

_ manicure ― 2017年03月30日 21:35

Hi, its nice paragraph on the topic of media print, we all be familiar with media is a impressive source of data.

_ manicure ― 2017年03月30日 21:38

I used to be suggested this web site by my cousin. I'm
not certain whether this put up is written via him as no one else recognise such distinct about my difficulty.
You're amazing! Thanks!

_ manicure ― 2017年03月30日 21:50

Wow! This blog looks just like my old one!
It's on a totally different subject but it has pretty much
the same page layout and design. Outstanding choice of colors!

_ manicure ― 2017年03月30日 22:02

When someone writes an article he/she maintains the
idea of a user in his/her brain that how a user can know it.
Thus that's why this piece of writing is amazing.

Thanks!

_ manicure ― 2017年04月03日 00:29

Asking questions are really fastidious thing if you are
not understanding anything totally, but this article provides nice understanding yet.

_ BHW ― 2017年04月13日 09:08

This website was... how do I say it? Relevant!! Finally I have found something that helped me.
Cheers!

_ stimulatingauto98.jimdo.com ― 2017年05月02日 09:27

Glad to be one of many visitors on this awing web site :D.

_ manicure ― 2017年05月03日 11:52

Useful info. Fortunate me I found your website
unintentionally, and I am surprised why this twist of fate did not
came about earlier! I bookmarked it.

_ manicure ― 2017年05月03日 18:35

Hi, just wanted to say, I loved this blog post.
It was inspiring. Keep on posting!

_ keithsazyyefzje.jimdo.com ― 2017年05月06日 23:25

These are really great ideas in on the topic of blogging. You have touched some pleasant
things here. Any way keep up wrinting.

_ buttons buttons ― 2017年07月07日 10:14

Cheap tea water bottle, Buy Quality water botttle directly from
China bottle botttle Suppliers: Snoopy 420ML Mug Coffee Cup Stainless
Steel Milk Teaa Mug Keep Muugs With Handle Anti-Dusst Coffee Cups Seal
Mass Tea Water Bottle
Cheap tea water bottle

_ Free auto approve list 10-17-2018 ― 2018年10月21日 17:00

There’s been a lot of changes since I last left a comment about
my site. I’m starting to add the new features that I’ve wanted
to. I hope in the next few weeks that all of it will be up and running.
It’s going to take time and I haven’t had much of it to dedicate
to this project. I thank you all for visiting my site and I hope you have
a great weekend!

_ lovelyvictoria ― 2018年10月26日 11:27

Don’t you think it’s time you had a little fun? You can have a whole lot of fun with this cam girl.
She’s a total blast and you’ll always have lots of fun with her.
She’s smoking hot and well worth spending some quality time with.
Check her out at http://www.camgirl.pw/lovelyvictoria/ and don’t be shy.
She loves meeting new people.

_ lena___ ― 2018年10月27日 12:17

How does relaxing and having a good time with a pretty blonde sound?
If it sounds like an exciting way to spend your time, then you need to check out
http://www.camgirl.pw/lena___/ She is a real doll
and this cam girl knows what you want to see. You’ll never ever be bored when the two of you are
all alone. Want to have the best time possible?
Take this girl directly into private and she’ll put a smile on your face.

_ nyc lash extensions ― 2018年10月29日 23:57

As soon as I found this web site I went on reddit to share some
of the love with them.

_ integratori per capelli ― 2018年10月30日 08:27

I am not sure where you are getting your
information, but great topic. I needs to spend some time learning much more or
understanding more. Thanks for magnificent information I was looking
for this information for my mission.

_ haar vitamine ― 2018年10月30日 08:40

At this moment I am going away to do my breakfast, once having my breakfast coming over again to read more news.

_ haar vitamine ― 2018年10月30日 10:43

Helpful information. Fortunate me I discovered your website by chance,
and I am stunned why this coincidence did not took place in advance!

I bookmarked it.

_ Most popular Halloween costumes ― 2018年11月01日 07:58

Do you know what the most popular Halloween costumes are for 2018?
Check out http://destyy.com/wZ21KY and see what they are.

You’re really going to be surprised by number
nine. It’s definitely one you’re not going to forget any
time soon.

_ mink lashes cheap ― 2018年11月05日 14:39

I got what you intend, thank you for putting up.
Woh I am happy to find this website through google.

_ mink lashes extensions ― 2018年11月06日 23:38

I got what you intend, regards for posting. Woh I am thankful to find
this website through google.

_ wildtequilla ― 2018年11月07日 03:41

Every guy needs to know a cam girl like http://www.camgirl.pw/wildtequilla/ She is a doll.
You’ll have a whole lot of fun with any girl at this site.

The type of fun that will put a smile on your face for days to come.

_ Edwina ― 2018年11月07日 18:32

Saved as a favorite, I really like your blog!

_ Does_Having_Lash_Expansion_Damage_Your_Genuine_Lashes_.D ― 2018年11月08日 20:06

That is a very good tip particularly to those fresh to the blogosphere.
Short but very accurate information? Many thanks for sharing
this one. A must read article!

_ Justin Bieber Face Tattoo ― 2018年11月09日 17:32

Did you hear that Justin Bieber just got a
face tattoo? He did. Check out his latest ink by clicking here http://kudoflow.com/45cF You’ll be surprised when you see what’s above his eye!

_ Best Woodworking Plans ― 2018年11月10日 02:29

Do you or someone you know work with wood? If so, then you’ve definitely got to check this
out http://kudoflow.com/4zRl It’s jam packed with all the information that a woodworker needs to know.

※コメントの受付件数を超えているため、この記事にコメントすることができません。

トラックバック