• 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: Strange NSManagedObjectContextObjectsDidChangeNotification behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior


  • Subject: Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior
  • From: Karolis Ramanauskas <email@hidden>
  • Date: Wed, 25 Feb 2009 08:55:35 -0600

>Lesson: Don't change model data in a -draw method.  I really can't think of any reason why you'd want to do this.   -draw is for drawing.

Yes, perhaps, but I have to change it, perhaps not in a draw method
itself, but in another method that get's called before it. In my real
program I have one, let's call it, MAIN object that has a draw method
and within it, it calls to draw methods of all its input objects:

    NSSet * myInputs = [self inputs];

    int inputCount = [myInputs count];

    if (inputCount != 0) {

        int n = 0;

        for (KRSimInput * input in myInputs) {

            [input setLocationX: ([self locationX] + ([self width] /
inputCount) * n++ + ([self width] / 2) / inputCount) - ([input width]
/ 2)];
            [input setLocationY: ([self locationY] - [input height] -
[input strokeWidth])];

            [input draw];

        }
    }

As you can see, before I can -draw an input I have to position it
right above the MAIN object. This position, as you can see from the
code, depends on inputCount and n, the current index. So I can't avoid
setters in -draw. Any suggestions?
_______________________________________________

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior
      • From: Jerry Krinock <email@hidden>
References: 
 >Strange NSManagedObjectContextObjectsDidChangeNotification behavior (From: Karolis Ramanauskas <email@hidden>)
 >Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior (From: Jerry Krinock <email@hidden>)
 >Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior (From: Dave Fernandes <email@hidden>)
 >Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior (From: Karolis Ramanauskas <email@hidden>)
 >Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Stop edit session with a NSTextField
  • Next by Date: Re: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
  • Previous by thread: Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior
  • Next by thread: Re: Strange NSManagedObjectContextObjectsDidChangeNotification behavior
  • Index(es):
    • Date
    • Thread