• 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: Finding front view in a Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding front view in a Cocoa app


  • Subject: Re: Finding front view in a Cocoa app
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 7 Jun 2008 23:17:11 -0700


On 2008 Jun, 07, at 22:38, Ron Lue-Sang wrote:


On Jun 7, 2008, at 9:11 AM, John James wrote:

This seems like it should be easy, but I can not find anything with various googles etc. I want to animate only my front view for performance reasons. How do i determine the current top view (document). I found something in carbon about FrontWindow, but I am trying to stay in Cocoa.
Any suggestions?
thanks John

Try [[NSApplication sharedApplication] mainWindow]
Tho I believe this will be nil if the application isn't active (as in, not the frontmost app).

There are other possibilities, too! John's question conflates several things:


"view" ► NSView ► the "key view"
"document" ► NSDocument ► the "active document"
"window" ► NSWindow ► the "frontmost window" or maybe the "key window"


So you see there could be lots of answers. Figure out what you want, then you'll probably be very close to the correct answer. I believe that the active document will come from something like

   [[NSApp orderedDocuments] objectAtIndex:0]
   // In real life, you'll check that array size first, won't you  ;)

and if you want the window, look similarly at [NSApp keyWindow] and/or [NSApp orderedWindows]

_______________________________________________

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


References: 
 >Finding front view in a Cocoa app (From: John James <email@hidden>)
 >Re: Finding front view in a Cocoa app (From: Ron Lue-Sang <email@hidden>)

  • Prev by Date: Re: Java and Objective-C
  • Next by Date: Re: Java and Objective-C
  • Previous by thread: Re: Finding front view in a Cocoa app
  • Next by thread: Re: Java and Objective-C
  • Index(es):
    • Date
    • Thread