• 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: Need help with dynamically adding tabs/populating from nib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with dynamically adding tabs/populating from nib


  • Subject: Re: Need help with dynamically adding tabs/populating from nib
  • From: Jeffrey Johnson <email@hidden>
  • Date: Fri, 17 Jun 2005 11:50:44 -0400

email@hidden (Todd Ransom) on 6/16/05(9:44 PM-0600) wrote:

>>     OdyExerciseView *newExercise = [[OdyExerciseView alloc] init];
>>
>>     //exerciseArray is an array in the windowController
>>     [exerciseArray addObject:newExercise];
>>
>>     [NSBundle loadNibNamed:@"OdyTabView" owner:newExercise];
>>     [newTabItem setView:newExercise];
>
>Is newExercise an NSView subclass or a controller? You are setting it
>as File's Owner and trying to set it as the view for the tab item,
>which doesn't make sense to me.
>
>What I did in my app was create a "view controller" with an outlet to
>an NSView that contains the view I want to display. So the above
>would look more like this:
>
>     OdyExerciseViewController *newExerciseController =
>[[OdyExerciseView alloc] init];
>
>     //exerciseArray is an array in the windowController
>     [exerciseArray addObject: newExerciseController];
>
>     [NSBundle loadNibNamed:@"OdyTabView" owner: newExerciseController];
>     [newTabItem setView: [newExerciseController mainView] ];

Thanks. I was trying to use OdyExerciseView as both a view and a controller- the only view behavior it had was to act as a grouper/container for the other subviews in IB, so I was stuffing outlets to the subviews and other controller-like code into it. Apparently that was a Bad Thing.

When I created a "OdyTabController" view (just as a subclass of NSObject, since it really isn't a NSWindowController. Did you subclass your "view controller" from something else?), moved all the outlets and controller-like code there and set it as the File's Owner, then loadNibNamed:owner into it instead, the views started coming up and operating. I can go back to the initial tab and add as many tabs as I want- cool!

(Now I get a BAD_ACCESS in objc_msgSend_rtp anytime I pass the mouse over the WebView I've embedded in the tab, but I'll take that to webkitsdk-dev- every  other view in the tab is working.)

Thanks
Jeffrey Johnson
Macintosh Development
Wavefunction, Inc.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Need help with dynamically adding tabs/populating from nib (From: Todd Ransom <email@hidden>)

  • Prev by Date: Re: Modal dialog alternatives?
  • Next by Date: Re: Modal dialog alternatives?
  • Previous by thread: Re: Need help with dynamically adding tabs/populating from nib
  • Next by thread: Wrong type of button in IB?
  • Index(es):
    • Date
    • Thread