IB NSTextField max size doesn't stick

Discussion in 'Mac Programming' started by lopoz, Apr 29, 2009.

  1. lopoz macrumors regular

    May 10, 2005

    I'm new to Cocoa programming and just bought a book to learn some Cocoa (Cocoa Programming by The Pragmatic Programmers).

    I'm trying to build a simple webbrowser (the first exercise in the book) and added a toolbar and a web view to my window. So far, so good.

    Now I added an NSTextField to my toolbar and want it to automatically resize when I change the size of the main window.

    So I set the maximum width to 2000:

    And the autosize options to anchor left, top and right and to resize horizontally:

    But when I click done, the maximum size of the NSTextField (which I set to 2000) goes back to the original size of the text field!

    Any ideas? I hope I explained it clearly enough, please do ask if something is vague..

    Thanks in advance!
  2. lopoz thread starter macrumors regular

    May 10, 2005
    Is this really that hard? TextFields not inside a toolbar work fine (i.e. they resize together with the window), but inside a toolbar they don't..
  3. kainjow Moderator emeritus


    Jun 15, 2000
    NSToolbars don't resize their views like a normal view does. I've seen code out there for replicating the behavior of how other apps like Safari and Mail resize text fields, so try searching around (cocoadev.com).
  4. lopoz thread starter macrumors regular

    May 10, 2005
    Thanks, I'll do that!

Share This Page