• 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 the view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: finding the view


  • Subject: Re: finding the view
  • From: David Remahl <email@hidden>
  • Date: Wed, 13 Mar 2002 15:48:18 +0100

> Hello
>
> I'm new to Cocoa, working on my first Cocoa project. I've used
> PowerPlant almost exclusively and MacApp before that so I'm not new to
> class libraries.
>
> I'm trying to do something which would be very easy in PowerPlant and
> I'm unable to find the right idiom in Cocoa.
>
> I have a window with a view in it. I want to programmatically replace
> that view with another view. I know about setContentView but my question
> is, how do I FIND the new view so I can pass it to setContentView.
>
> In PowerPlant I would have called FindViewByID (or something like that)
> and passed it the 32 bit "code" for the view that I setup in Constructor.
>
> Right now I have a nib file with all my views inside of it but I don't
> know how to find them so I can pass them to setContentView.
>
> I've searched the Learing Cocoa and the Hillegass books to no avail.
>
> Thanks for any advice. I'm sure this is just an idiom issue, I'm still
> thinking PowerPlant.
>
> Paul

You create an outlet to it in Interface Builder!

And if you don't want to replace the full content of the window, but only a
subview, there is a replaceSubview:withSubview: method (or something like
that). Don't forget to set the origin of the new view.

/ david
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: finding the view
      • From: Paul Cezanne <email@hidden>
References: 
 >finding the view (From: Paul Cezanne <email@hidden>)

  • Prev by Date: finding the view
  • Next by Date: Re: finding the view
  • Previous by thread: finding the view
  • Next by thread: Re: finding the view
  • Index(es):
    • Date
    • Thread