Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In <code>awakeFromNib:</code> the application is not fully launched yet, only this NIB file has been unmarshalled. At this point this method gives you a hook to complete (object-local) initialization. The application is (quite likely) not ready to process events or perform actions.</p> <p>You should trigger that action from <code>applicationDidFinishLaunching:</code> method, an optional method in the application delegate, and pass in the status item like a click would do (because you query it for <code>bounds</code>).</p> <p><strong>Update.</strong> This is trickier than I had thought. Turns out, the NSStatusItem doesn't have a view associated at that point when the delegate gets called. I'd venture to say that is a bug with <code>NSStatusItem</code>. When <code>statusItem.view</code> is called in <code>applicationDidFinishLaunching:</code>, the popover method receives <code>nil</code> and complains. </p> <p>The only (partial, see below) workaround that I have found is to set a button as view manually in <code>awakeFromNib:</code> like so:</p> <pre><code>- (void)awakeFromNib { self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; self.statusItemButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 83, 22)]; self.statusItemButton.title = @"Locating..."; self.statusItemButton.bordered = NO; [self.statusItemButton setAction:@selector(clickStatusBar:)]; self.statusItem.view = self.statusItemButton; } </code></pre> <p>That way you'd have a view around when the application is done launching. But beware, it doesn't look like the default one. </p> <p>PS. <em>And curiously, and does not even work every time.</em> I have to drop the ball here. Sorry. Maybe save the location in the defaults when somone clicks. I think I saw such an inconsistency in Cloud.app and with a popover next to a status item, and maybe now we know why :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload