Results 1 to 3 of 3
  1. #1

    Member Since
    Jun 08, 2013
    Būr said,Egypt
    MacBook Pro (i5)
    Heeeeeelp! How to write String into NSView?
    guys, i want the user to scroll while reading text,but the deal is that the multiple line label doesn't support scrolls and Scroll View doesn't support stringValue. need some help

  2. #2

    Raz0rEdge's Avatar
    Member Since
    Jul 17, 2009
    27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3
    Threads merged - please don't post the same question into multiple threads..

    Might I suggest that you do some searching in your favorite search engine for your answer or buy a book about OS X/iOS development..

    Be sure to read the Community Guidelines | The more information you provide, the better answers you get, remember GIGO.

  3. #3

    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    West Sussex, UK
    You can put the multiline label in the scroll view, but I did restle a bit with it myself.

    I placed a multiline label on a window from the object library, and also a scroll view from the object library, then I created two IBOutlet properties in my AppDelegate, one of a NSTextField called myMultilineLabel, and one of a NSScrollView class called myScrollView, then finally connect them in Interface Builder too the Label and Scroll View on the window.

    next I sized the label too what it needed to be, to hold the text it was going to hold, then I selected the scroll view, and double clicked it's interior to select it's content view, then I resized the content view with the inspectors size tab, by entering the sizes to the labels size.

    then in the AppDelegate's applicationDidBecomeActive: method, I entered the code below.

        NSString *myString = [[NSString alloc] initWithFormat:@"line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\n"];
        [myMultiLabel setStringValue:myString];
        [myScrollView addSubview:myMultiLabel];
        [myScrollView setDocumentView:myMultiLabel];
    A second way to achieve this is to select your multi label, and then from Xcode's editor menu, select Embed In > Scroll View.
    But as of writing I did'nt get this method to work very well, but will let you know if I can.

    Regards Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Heeeeeelp! How to write String into NSView?
    By Yodda_Hunter in forum OS X - Apps and Games
    Replies: 0
    Last Post: 01-17-2014, 03:43 PM
  2. StringValue into NSView(Objective-c)
    By Yodda_Hunter in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 01-16-2014, 06:35 PM
  3. StringValue into NSView(Objective-c)
    By Yodda_Hunter in forum OS X - Apps and Games
    Replies: 0
    Last Post: 01-16-2014, 06:35 PM
  4. Windows fail heeeeeelp
    By chaunceystangle in forum Running Windows (or anything else) on your Mac
    Replies: 2
    Last Post: 11-07-2008, 03:28 PM
  5. localized string not found?
    By maz94protege in forum OS X - Operating System
    Replies: 2
    Last Post: 12-21-2005, 02:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts