3

I have a 10.6 app that I am building on Lion with Xcode 4.3

There is a horizontal split view in the main view, containing the following:

The top view contains an NSSearchField with an NSTableView below it.

The bottom view contains a WebView.

I have it working, but when I resize the split view the top view behaves oddly.

What I want to happen is for the search field to remain where it is, the tableview to remain where it is, but to expand if the split view is dragged down. If dragged up, I want the webview to overwrite the search field and table view.

You can see what I mean in this clip: http://dl.dropbox.com/u/160638/Work/TENSOFT/resizemostlyokay.mov

This keeps the things in the right place when I drag up, but doesn't expand the table when I drag down. The view is expanded, but not the table.

So, I changed the autosizing constraint on the table view / scroll view to make it expand when the view is resized. This is what happens: http://dl.dropbox.com/u/160638/Work/TENSOFT/resizeproblem.mov

When the split bar is moved upwards the table view is moved upwards inside the top view until it overwrites the search field. It doesn't move back when the bar is moved back down.

I cannot find a way to make this work by changing the autosizing constraints. This is usually pretty easy stuff, so either I'm missing something obvious or...?

Has anyone seen this behaviour before when creating SL apps on Lion with Xcode 4.3?

FYI, if I replicate this in a new 10.7 project using auto-layout everything works fine.

Regards

Darren.

Darren Wheatley
  • 456
  • 1
  • 3
  • 14

1 Answers1

2

When you allow an NSSplitView to make one of its subviews very small so that the subviews effectively overlap you get layout issues and this is one of the reasons that Apple introduced auto-layout (watch the WWDC video about auto-layout and I think they demo this problem near the beginning).

If I were you I'd set a minimum size for the top pane so that, for example, it stops resizing when it is 100px high. You can then allow it to collapse so that the user can still show just the WebView.

sgaw
  • 3,118
  • 1
  • 17
  • 6