• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie NSView confusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie NSView confusion


  • Subject: Re: Newbie NSView confusion
  • From: publiclook <email@hidden>
  • Date: Sat, 4 Oct 2003 19:02:42 -0400

On Saturday, October 4, 2003, at 01:05 PM, Sailor Quasar wrote:

<begin short rant>
This is one of those times when Carbon would have been simpler. In Carbon the call to create such a text field would have required at most two lines for CreateStaticTextControl() and would have worked on the first shot. Here in Cocoa I'm playing with attributes of a over-generalized text view subclass like mad and getting more or less nowhere.
</end short rant>


<begin short rant reply>
It often seems simpler to do almost anything with a familiar framework than with an unfamiliar framework particularly when the basic paradigms are different between the two frameworks.
</end short rant reply>

If all you want to do is draw un-editable '.' characters at arbitrary positions within a view, adding sub-views is almost certainly overkill whether the sub view is an NSTextView or and NSTextField. See the various text drawing APIs at different levels of the frameworks. See http://www.cocoaprogramming.net/Downloads.html for many examples of how to draw formatted text in a custom view. Even if you want to use sub-views for this purpose, it may be easier to set up a prototypical view the way you want it in IB and then programatically copy the prototype instance as many times as you want adding each copy as a sub-view of your custom view. You seem to already know how to add sub-views. You can copy an arbitrary graph of objects using code as shown in the following:

copyOfSomeView = [NSUnarchiver unarchiveObjectWithData:[NSArchiver archivedDataWithRootObject:someView];

The copy will include all nested sub-views in someView etc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Newbie NSView confusion (From: Sailor Quasar <email@hidden>)

  • Prev by Date: Re: Fading audio in NSMovieView
  • Next by Date: Xcode and Info.plist
  • Previous by thread: Re: Newbie NSView confusion
  • Next by thread: XCode Settings for Info.plist keys
  • Index(es):
    • Date
    • Thread