New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Heeeeeelp! How to write String into NSView?


Post Reply New Thread Subscribe

 
Thread Tools
Yodda_Hunter

 
Member Since: Jun 08, 2013
Location: Būr said,Egypt
Posts: 158
Yodda_Hunter is on a distinguished road
Mac Specs: MacBook Pro (i5)

Yodda_Hunter is offline
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
QUOTE Thanks
Raz0rEdge

 
Raz0rEdge's Avatar
 
Member Since: Jul 17, 2009
Location: MA
Posts: 7,737
Raz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant future
Mac Specs: 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3

Raz0rEdge is offline
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..

--
Regards
...Ashwin



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

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 170
Mark FX has a spectacular aura about

Mark FX is offline
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.

Code:
    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
QUOTE Thanks

Post Reply New Thread Subscribe


« StringValue into NSView(Objective-c) | ssh into idle ? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
How to Write iMovie Project to DVD? Trevor2522 Movies and Video 8 12-28-2013 02:04 PM
How do i make my read-only WD Passport drive to read and write drive?? Zeesh Other Hardware and Peripherals 3 06-06-2012 06:03 AM
Cannot write to SMB share neufena OS X - Operating System 0 11-04-2010 08:13 AM
Another write privileges problem w/ iTunes poodlefan33 OS X - Apps and Games 0 11-04-2010 02:36 AM
Seagate 7200.10 incompatible? Detailed benchmarks! otheronenorehto Apple Desktops 5 01-15-2007 05:38 AM

All times are GMT -4. The time now is 04:22 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?