• 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: Dynamically update drawRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically update drawRect


  • Subject: Re: Dynamically update drawRect
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 27 Dec 2009 04:10:59 -0800

On Dec 27, 2009, at 01:18, proger proger wrote:

> I'm still don't know how to do it. As solution i see programmically create MyView class and call drawRect function as i needed. Because now MyView(NSView) is created by nib. And i can't call MyView class instance methods. How to programmically add Custom View and set MyView class ?

I think the piece of information you're missing is that, in Interface Builder, when you drag a custom view "object" into a window, you can then set the *class* of the custom view to any NSView subclass that's defined in your project (such as "MyView", if that's what you've called it).

Then, since your custom view is in a nib, you'll need a way of referring to it. Normally, you'd add an outlet to the nib's File's Owner object, and connect that to your view.

That gives you what you need: a custom view created automatically when the nib is loaded, plus a reference to the custom view that you can use for sending messages to.

Further references:

	http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaViewsGuide/SubclassingNSView/SubclassingNSView.html#//apple_ref/doc/uid/TP40002978-CH7-SW4
	http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/IB_UserGuide/EditingNibFileObjects/EditingNibFileObjects.html#//apple_ref/doc/uid/TP40005344-CH12-SW31
	http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW19


_______________________________________________

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: Dynamically update drawRect
      • From: proger proger <email@hidden>
References: 
 >Dynamically update drawRect (From: proger proger <email@hidden>)
 >Re: Dynamically update drawRect (From: Gideon King <email@hidden>)
 >Re: Dynamically update drawRect (From: Quincey Morris <email@hidden>)
 >Re: Dynamically update drawRect (From: proger proger <email@hidden>)

  • Prev by Date: Re: Dynamically update drawRect
  • Next by Date: resizing NSCollectionView enclosed view items
  • Previous by thread: Re: Dynamically update drawRect
  • Next by thread: Re: Dynamically update drawRect
  • Index(es):
    • Date
    • Thread