• 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: Re-using a custom view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re-using a custom view


  • Subject: Re: Re-using a custom view
  • From: Sean Murphy <email@hidden>
  • Date: Fri, 8 Dec 2006 23:00:34 -0500

At 10:54 AM -0800 12/8/06, Shawn Erickson wrote:

...
5) Each time you need the view instantiate a new "controller" class and do what you want with the view it has a reference to.

On Dec 8, 2006, at 2:23 PM, Sanford Selznick wrote:

Wonderful.  Thank you very much.

Is 5 as simple as calling NSView's addSubView on the "host" view? Will that fix up field tab ordering and everything?

Yes, for the most part the key view loop will be automatically updated by the parent NSWindow whenever a subview is added. This functionality was added to the AppKit in 10.4. You can control this behavior by using NSWindow's autorecalculatesKeyViewLoop and setAutorecalculatesKeyViewLoop methods.


The reason I said "for the most part" is because the auto calculation does its work based on the geometric order of the views inside the NSWindow (The same calculation is performed if the window has no initialFirstResponder). This is usually acceptable, but in cases where it's not (or when you're targeting Panther + earlier), you can explicitly use setNextKeyView:.

Some ADC links for more reference:

NSView: <http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/Classes/NSView_Class/index.html>

NSWindow: <http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/Classes/NSWindow_Class/index.html>

- Sean
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Re-using a custom view (From: Sanford Selznick <email@hidden>)
 >Re: Re-using a custom view (From: Shawn Erickson <email@hidden>)
 >Re: Re-using a custom view (From: Sanford Selznick <email@hidden>)

  • Prev by Date: PDFKit: problem with PDFView goToDestination across PDFViews.
  • Next by Date: Re: Launch with bundle fails the first time
  • Previous by thread: Re: Re-using a custom view
  • Next by thread: Launching a external application from my application
  • Index(es):
    • Date
    • Thread