01-17-2014, 03:43 PM #1
Heeeeeelp! How to write String into NSView?
- Member Since
- Jun 08, 2013
- Būr said,Egypt
- MacBook Pro (i5)
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
01-17-2014, 04:32 PM #2
- Member Since
- Jul 17, 2009
- 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 6S, iPod Nano 7th GeniPad 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..
01-19-2014, 05:13 PM #3
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];
But as of writing I did'nt get this method to work very well, but will let you know if I can.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By Yodda_Hunter in forum OS X - Apps and GamesReplies: 0Last Post: 01-17-2014, 03:43 PM
By Yodda_Hunter in forum OS X - Development and DarwinReplies: 0Last Post: 01-16-2014, 06:35 PM
By Yodda_Hunter in forum OS X - Apps and GamesReplies: 0Last Post: 01-16-2014, 06:35 PM
By chaunceystangle in forum Running Windows (or anything else) on your MacReplies: 2Last Post: 11-07-2008, 03:28 PM
By maz94protege in forum OS X - Operating SystemReplies: 2Last Post: 12-21-2005, 02:24 AM