Thanks. That certainly works, but I found the trick: set the line break mode for the whole thing to "word," and put in the non-breaking hyphen using the Special Characters palette.
On Jan 24, 2014, at 00:14 , Mark Woollard <mark.wooll...@mac.com> wrote: > From [UILabel setLineBreakMode:] documentation: > > If you are using styled text in iOS 6 or later, assigning a new value to this > property causes the line break mode to be applied to the entirety of the > string in the attributedTextproperty. If you want to apply the line break > mode to only a portion of the text, create a new attributed string with the > desired style information and associate it with the label. If you are not > using styled text, this property applies to the entire text string in the > text property. > > So build an attributed string with no wrapping where you want to keep > hyphenated words unbroken and assign to the labels attributedText property. > Wrapping is property of NSParagraphStyle, set with > NSParagraphStyleAttributeName attribute on the string. > > Regards > Mark > > On 24 Jan 2014, at 07:59, Rick Mann <rm...@latencyzero.com> wrote: > >> I have a UILabel that breaks lines if the text gets too long. Traditionally, >> on the Mac, you could type an option-hyphen to get a non-breaking hyphen, >> but this still breaks (when I type option-hyphen in my source code file in >> Xcode). >> >> Is there a way to get a non-breaking hyphen in a UILabel? >> >> Thanks >> >> -- >> Rick >> >> >> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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: >> https://lists.apple.com/mailman/options/cocoa-dev/mark.woollard%40mac.com >> >> This email sent to mark.wooll...@mac.com > -- Rick
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com