• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSNotifications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotifications


  • Subject: Re: NSNotifications
  • From: Aaron Boothello <email@hidden>
  • Date: Thu, 26 Oct 2006 07:40:12 +0800

Hey Clint,
here's some pseudo code. and im currently only posting a notification when i drag a mouse.....just testing to see if tis would actually work the way i want it to.


my3DObject class: (poster of notification)

static NSString *NSObjectDidChange;

//called when object is changed to post a notification
-(void)objectDidChange
{
[[NSNotificationCenter defaultCenter] postNotificationName:NSObjectDidChange object:self];
}

myView classes (each view is observer classes):


- (id)initWithFrame:(NSRect)frameRect
	{
	.
	.
	[[NSNotificationCenter defaultCenter] addObserver:self
                     selector:@selector(viewNeedsUpdate:)
                     name:NSObjectDidChange
                     object:mySuperModel];
	.
	.
	}

- (void)mouseDragged:(NSEvent *)theEvent
{
	// change object accoridingly
	.
	.
	[myObject objectDidChange];
}

i'm not even posting a notification in the mouseUp method. but it only seems to be refreshing the views when i life the mouse button (ive commented out all the "[view setNeedsDisplay:YES]" in the code.

Out of curiosity i put a debugging statement in the "objectDidiChange" method...a "printf"...and it just keep coming into this method no matter what..weter or not the mouse is pressed or not.

Thanks.


On 26/10/2006, at 2:02 AM, Clint Shryock wrote:

Aaron-

could you be more specific (code snippets) as to where you are sending notifications.
it sounds like your posting the notification with mouseUp:(NSEvent *)event
instead you would want mouseDragged:(NSEvent *)event
without code i can't really tell if my suggestion is relevant or at least not completely stupid, so i could be way off.


-Clint

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSNotifications
      • From: "Clint Shryock" <email@hidden>
  • Prev by Date: Re: Keys down while dragging
  • Next by Date: Init Problem
  • Previous by thread: Re: NSNotifications
  • Next by thread: Re: NSNotifications
  • Index(es):
    • Date
    • Thread