• 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: NSTextAlignment Enum?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextAlignment Enum?


  • Subject: Re: NSTextAlignment Enum?
  • From: Dave <email@hidden>
  • Date: Mon, 01 Sep 2014 19:44:34 +0100

Hi,

The method that returns the NSTextAlignment is interpreting other data to come up with the best alignment, if there is no “Best Alignment” it needs to signal this back to the caller.

I’ve solved the problem by returning a BOOL to say if the NSTextAlignment is valid or not and passing the actual NSTextAlignment value as &myTextAlignment, e.g.

if ([self getBestAlignmentWithParam1:p1 andParam2:p2 andParam3:p3 returnTextAlignment: &myTextAlignment] == NO)
	{
// do something else
	}

Cheers
Dave


On 1 Sep 2014, at 18:30, Mills, Steve <email@hidden> wrote:

> On Sep 1, 2014, at 11:44, "Keary Suska" <email@hidden> wrote:
>>
>> One future-proof approach that occurred to me is to declare your own enum:
>>
>> typedef NS_ENUM(NSInteger, MYTextAlignment) {
>>   MYInvalidTextAlignment    = -1,
>>   MYLeftTextAlignment        = NSLeftTextAlignment,
>>   MYRightTextAlignment    = NSRightTextAlignment,
>>   MYCenterTextAlignment    = NSCenterTextAlignment,
>>   MYJustifiedTextAlignment    = NSJustifiedTextAlignment,
>>   MYNaturalTextAlignment    = NSNaturalTextAlignment
>> };
>
> I was thinking of that too, but it doesn't future-proof it if Apple adds more enums, especially if new ones are out of the max signed int range.
>
> Steve via iPad
> _______________________________________________
>
> 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


_______________________________________________

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


References: 
 >NSTextAlignment Enum? (From: Dave <email@hidden>)
 >Re: NSTextAlignment Enum? (From: Keary Suska <email@hidden>)
 >Re: NSTextAlignment Enum? (From: Keary Suska <email@hidden>)
 >Re: NSTextAlignment Enum? (From: "Mills, Steve" <email@hidden>)

  • Prev by Date: Re: NSTextAlignment Enum?
  • Next by Date: Re: My services in my own app
  • Previous by thread: Re: NSTextAlignment Enum?
  • Next by thread: Re: How to Validate CoreData attribute value for uniqueness
  • Index(es):
    • Date
    • Thread