• 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
Custom Table View Cells and String Text Alignment and Breaking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom Table View Cells and String Text Alignment and Breaking


  • Subject: Custom Table View Cells and String Text Alignment and Breaking
  • From: Grant Erickson <email@hidden>
  • Date: Thu, 06 Aug 2009 17:08:43 -0700
  • Thread-topic: Custom Table View Cells and String Text Alignment and Breaking

I am implementing a non-editable custom table view cell (a bit similar to
the network connection listing in the System Preferences Network preference
pane) in a single-column, no header NSTableView.

The cell consists of an image, another image, two stacked strings (left
aligned), another string (right aligned) and a custom-drawn graphic:

      .------..--------------------------.                   .------.
  .--.|      ||                          |.-----------------.|      |
  !__!|      ||--------------------------|!_________________!|      |
      !______!!__________________________!                   !______!

  Img  Image   Strings                                String  Drawn

At this point, I've all the icons and graphics drawing correctly and the
text displaying with attributes (i.e. inverting when selected, etc.) using
drawAtPoint:withAttributes:.

However, with regard to the strings, particularly concerning the
right-alignment of the non-stacked string, nudging around the X points to
achieve the proper right-alignment seems like the wrong way to approach this
and that I should be specifying NSTextAlignment in some way when the string
is drawn.

In addition, paragraph style attributes (NSRightTextAlignment or
NSLineBreakByTruncatingMiddle) seem (perhaps unsurprisingly) to not apply to
drawAtPoint:withAttributes:.

Do I need to create or should I instead be creating three NSTextViews, one
for each string, and adding them as subviews to my custom cell's view rather
than trying to use drawAtPoint:withAttributes:?

Regards,

Grant Erickson


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Custom Table View Cells and String Text Alignment and Breaking
      • From: Grant Erickson <email@hidden>
    • Re: Custom Table View Cells and String Text Alignment and Breaking
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Disabling Exposé in SystemUIMode
  • Next by Date: Re: Disabling Exposé in SystemUIMode
  • Previous by thread: Re: Mixing Objective-C and C++ classes; How?
  • Next by thread: Re: Custom Table View Cells and String Text Alignment and Breaking
  • Index(es):
    • Date
    • Thread