开发者

unable to click button while updating current location

As fetching current location requires much time so i want to add cancel but开发者_StackOverflow中文版ton. But i'm unable to click any button until it gets the current location. Any suggestions???


When you run things on the main thread it, can lock everything up - try getting the location using

[self performSelectorInBackground:@selector(mySelector:) withObject:objectName];

UPDATE:

You will need to make an autorelease pool for this new thread too, so as the first line in mySelector, put:

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

and at the last line, put:

[pool release];

All of your other code goes in between. If you don't do this, then you'll get nasty memory problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜