• 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: initial value of an NSPopupButton shows with delay
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: initial value of an NSPopupButton shows with delay


  • Subject: Re: initial value of an NSPopupButton shows with delay
  • From: Peter Ammon <email@hidden>
  • Date: Thu, 16 Aug 2012 17:50:31 -0700

Hi Koen,

Is your window set to be visible at launch (i.e. in IB)? Try making it not visible at launch, and then ordering it onscreen after the nib is loaded. That should allow all the awakeFromNib methods to run before the window appears.

Hope that helps,
-Peter

On Aug 16, 2012, at 3:53 PM, Koen van der Drift <email@hidden> wrote:

> I have an NSPopupButton that is bound to an NSArrayController in IB as follows:
>
> Content -> ac.arrangedObjects
> ContentValue -> ac.arrangedObjects.name
> SelectedObject -> File's Owner.self.currentObject
>
> The ac is bound to entities that are in my CD store (which are created when the app starts up for the first time, following the code example for the "Type" entity in the Grokking Recipes app from Zarra's Core Data book). I am using the SelectedObject binding so that when the popup is changed, I immediately get the selectedobject from the ac. This works like a charm.
>
> Now when the view first appears, I'd like to set the NSPopupButton to a default value, so I added this to awakeFromNib of my NSViewController to get the entity with the name "defaultName":
>
>    NSManagedObjectContext  *moc = [[NSApp delegate] managedObjectContext];
>    NSArray *results = [moc fetchObjectsForEntityName: @"MyObject" withPredicateString: @"name == %@", @"defaultName"];
>
> (that last line is based on this article: http://cocoawithlove.com/2008/03/core-data-one-line-fetch.html)
>
> then I set the currentObject to that entity:
>    self.currentObject = [results lastObject];
>
> It works, I get the entity with defaultName as the initial value in the popup, but for a split second, I first see something else, as if there is some delay before the popup is set to the correct item.
>
> Is this delay because I do a fetch in my CD store?   If so is there a faster way to do this, to prevent the delay?
>
> - Koen.



_______________________________________________

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: initial value of an NSPopupButton shows with delay
      • From: Koen van der Drift <email@hidden>
References: 
 >initial value of an NSPopupButton shows with delay (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: launch application de-elevated
  • Next by Date: Re: help indexer or hiutil help
  • Previous by thread: initial value of an NSPopupButton shows with delay
  • Next by thread: Re: initial value of an NSPopupButton shows with delay
  • Index(es):
    • Date
    • Thread