Re: NSTextAlignment Enum?
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