• 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
NSScrollView: special handling of subview's headerView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSScrollView: special handling of subview's headerView?


  • Subject: NSScrollView: special handling of subview's headerView?
  • From: Aaron Burghardt <email@hidden>
  • Date: Tue, 23 Jun 2009 21:11:04 -0400

Hi All,

I recently encountered a problem with a custom NSView sublcass that is designed to be a container for 3 WebViews and is embedded in a scroll view. The problem was that once the view was added to the view hierarchy, one of its WebViews was removed and inserted as a sibling to the view. I posted a question on the WebKit SDK mailing list because I thought my problem was related to WebView, but I determined that it occurred because my NSView subclass had an instance variable named headerView and that view was automatically set up as if a header, similar to an NSTableView or NSOutlineView column headerView. Renaming the ivar eliminated the problem. My question is, is this documented behavior? I intend to file a documentation bug, but I wanted to make sure I didn't miss something.

Thanks,

Aaron


Begin forwarded message:


On Jun 22, 2009, at 8:42 PM, Jeff Johnson wrote:

Hi Aaron.

Could you create a full sample app?

On Jun 22, 2009, at 1:35 PM, Aaron Burghardt wrote:

This is a slightly simplified version, but it shows the general approach. The goal was to have HTML content that matched the width of MyView, so the WebViews are instructed to -layout whenever the width changes. After they are laid out, the height of MyView is adjusted to match the natural height of the stacked WebViews. In Interface Builder, an instance of MyView is embedded in an NSScrollView.

Thanks,

Aaron

@interface MyView : NSView
{
	WebView *webView1;
	WebView *webView2;
	WebView *webView3;
}
@end


In the process of creating a test app, I figured it out. Apparently, NSScrollView has special handling for a subview that has an instance variable called headerView. In my original project, the WebView ivars had other names, one of which was headerView. When the instance of MyView is added as a subview to the NSScrollView, the headerView is removed from MyView's subviews and inserted in the scroll view parent. NSTableView and NSOutlineView also have a headerView, but they are probably designed to expect this behavior. When I renamed the variable, the problem went away.

Cheers,

Aaron


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: NSScrollView: special handling of subview's headerView?
      • From: Quincey Morris <email@hidden>
  • Prev by Date: problem with "selection" controller key when showing NSComboBoxCell content values
  • Next by Date: Re: Opinion on managed memory and garbage collection
  • Previous by thread: problem with "selection" controller key when showing NSComboBoxCell content values
  • Next by thread: Re: NSScrollView: special handling of subview's headerView?
  • Index(es):
    • Date
    • Thread