• 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: Do i need custom views created programatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do i need custom views created programatically


  • Subject: Re: Do i need custom views created programatically
  • From: Cathy Shive <email@hidden>
  • Date: Wed, 13 Feb 2008 14:03:57 +0100

Hi Nick,

You don't need to create your views programmatically unless you want to.

Here's one suggestion (there are several ways to go about this):

- Make all the views you want to switch between in Interface Builder using a multiple "custom views" instead of a window.

- Make a controller class that will load the nib, handle the view switching and action handling.

- Set the custom class of your nib's 'file's owner' to your controller class, connect all the outlets and actions to the file's owner. When the nib is loaded in code, the connections will be made.

this is a good link with some code that shows how to load nibs programmatically and some discussion of the 'file's owner' concept.
http://www.cocoadev.com/index.pl?SharingNibsBetweenWindows


- you can switch between the views by adding and removing subviews to and from a main "container" view.

read about working with a view hierarchy:
http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_5_section_1.html#// apple_ref/doc/uid/TP40002978-CH4-SW1


Of course, this design can be more finely grained with multiple controllers and nib files, it all depends on your needs.

One thing that sticks out to me in your post is that you're talking about having the user click a button and then removing the view that that button is in when they click. This might be confusing to the user. You generally don't want buttons to disappear from under the mouse, but sometimes it happens, i guess.

Think about how tabs and source lists work to dynamically switch between interfaces.

All the best,
Cathy

On Feb 13, 2008, at 1:13 PM, Nick Rogers wrote:

Hi,
I have a part (view) of my main app window that should display a few buttons at one time and when clicked any button, the same view has to change to something else, which would also change to a browser view some time later.


Now I gather that I can not create such changing views using IB to edit the nib file.

So, I'd need to create a view programatically and when changed, the next view should also be done programatically.

Am I right?

Also is it possible to change view like that?

Wishes,
Nick
_______________________________________________

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

_______________________________________________

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: 
 >Do i need custom views created programatically (From: Nick Rogers <email@hidden>)

  • Prev by Date: Re: KVC and KVO for arrays
  • Next by Date: Re: NSView -drawRect optimization
  • Previous by thread: Re: Do i need custom views created programatically
  • Next by thread: Re: Do i need custom views created programatically
  • Index(es):
    • Date
    • Thread