• 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: Superimpose a NSTextField over NSImageView? [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Superimpose a NSTextField over NSImageView? [SOLVED]


  • Subject: Re: Superimpose a NSTextField over NSImageView? [SOLVED]
  • From: Ryan Britton <email@hidden>
  • Date: Mon, 24 Apr 2006 08:59:24 -0700

Here's a snippet from the docs to consider when deciding which option you use.

Prior to Mac OS X v10.4, the NSString and NSAttributedString classes were intended for rendering text occasionally in your program. The performance of these drawing methods was not as good as the performance you could get by rendering text using the Cocoa text system. Also, the layout for strings is limited to a simple rectangular area in the current view. In Mac OS X v10.4, performance of the string drawing methods improved significantly and is useful in many situations; of course, you should always measure the performance yourself and see if it is adequate for your program. If you need to do more complex text layout, you should still consider using the Cocoa text system.


On Apr 24, 2006, at 8:41 AM, M. Uli Kusterer wrote:

On 24/04/06, Henry McGilton <email@hidden> wrote:

I must be missing something critical here. What is wrong with just having the image view and using the NSString drawing additions to superimpose the text ?


For one thing, performance. NSStringDrawing creates and tears down several
text system objects to draw a string. It also doesn't necessarily wrap text.
An NSTextView carries arround its text system objects and reuses them.


Also, you can use bindings with an NSTextField or NSTextView while you'd
have to write a bunch of code to use them with a subclassed NSImageView.


And did I mentioned you can just reuse an NSImageView and NSTextView instead
of having to subclass the former?


Mind you, I'd personally use IB for this, but the OP insisted on having to
do this programmatically, so I suggested use of addSubview. IMHO using IB is
the better choice. If you need custom border drawing, you can create a
reusable NSWindow subclass once and use it in other apps easily just by
dragging it into IB. I'm doing that with UKBorderlessWindow all the time.


Cheers,
M. Uli Kusterer
------------------------------------------------------------
       "The Witnesses of TeachText are everywhere..."
                   http://www.zathras.de
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Superimpose a NSTextField over NSImageView? (From: Erik Buck <email@hidden>)
 >Re: Superimpose a NSTextField over NSImageView? [SOLVED] (From: desktoast music productions <email@hidden>)
 >Re: Superimpose a NSTextField over NSImageView? [SOLVED] (From: "M. Uli Kusterer" <email@hidden>)
 >Re: Superimpose a NSTextField over NSImageView? [SOLVED] (From: Henry McGilton <email@hidden>)
 >Re: Superimpose a NSTextField over NSImageView? [SOLVED] (From: "M. Uli Kusterer" <email@hidden>)

  • Prev by Date: Re: Custom view - newbie stumped
  • Next by Date: Re: Using NSUserDefaultsController with radio buttons
  • Previous by thread: Re: Superimpose a NSTextField over NSImageView? [SOLVED]
  • Next by thread: Re: Superimpose a NSTextField over NSImageView?
  • Index(es):
    • Date
    • Thread