Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [FIXED] calling scrollPoint: on table view from separate thread locks up app




On August 9, 2007, Nick Zitzmann wrote:


On Aug 9, 2007, at 2:14 PM, Chase wrote:

can someone shed some light on why this might be happening.

The AppKit isn't 100% thread-safe. You'll have to perform the scroll in the main thread.


Nick Zitzmann
<http://www.chronosnet.com/>



thanks.

in case someone 10 years from now is searching through the list archives for an answer to this question, here's what i did...

in init:

[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(testnotificationreceiver:) name:@"ANIMALCRACKERS" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];


in thread:

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"ANIMALCRACKERS" object:nil userInfo:nil deliverImmediately:YES];

and added the following method:

// this is called in the main thread:
- (void)testnotificationreceiver:(NSNotification *)notification
{
	[mytableview scrollPoint:NSMakePoint(0.0,0.0)];
}



i used NSDistributedNotificationCenter, because it posts to the main thread -- and does so by default too.

- chase




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.