Re: Accessing programatically to attribute length in run-time
Re: Accessing programatically to attribute length in run-time
- Subject: Re: Accessing programatically to attribute length in run-time
- From: "Stephen Deken" <email@hidden>
- Date: Wed, 21 Feb 2007 11:00:30 -0600
On 2/21/07, Txinto Vaz <email@hidden> wrote:
Thanks a lot again.
Glad to help. Looking over the code again, I notice that I've made at
least two other errors. The lines:
id tmp = [re constantValue];
maxLength = [tmp isKindOfClass:@"NSString"] ? [tmp intValue] : tmp;
The comparison will always be false, because I meant to type [NSString
class], but the [tmp intValue] would assign an integer to the NSNumber
instance, which is almost universally bad.
You ought to just replace that whole thing with maxLength = [re
constantValue], since you're always going to be calling -[intValue] on
it later. You could also probably get away with just a `return [[re
constantValue] intValue]` at that point as well, if you didn't want to
do any error checking.
--
Stephen Deken
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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