How can I check if my UILabel value is above 0? [closed]?

This error appears: pastie. Org/2956098 – pixelbitlabs Dec 2 at 18:13 @pixelbitlabs This isn't from this snippet. Look for a place in your code where you call isEqualToString on an instance of UILabel; there is no such method on UILabel.

– dasblinkenlight Dec 2 at 18:16 How can I find out what exactly is causing it as I can't see anything which uses isEqualToString and is a UILabel... – pixelbitlabs Dec 2 at 18:21 @pixelbitlabs This error also happens when you assign new value to UILabel's text. If you try assigning myLabel. Text = otherLabel instead of myLabel.

Text = otherLabel. Text, you'll get that error. – dasblinkenlight Dec 2 at 18:26 I've checked, nothing in my code is like that.It's really weird :( – pixelbitlabs Dec 2 at 18:38.

If you're sure the text value of the UILabel is numeric, you could just do this: - (BOOL)valueGreaterThanZero:(UILabel *)label { NSString *text = label text; int value; NSScanner scannerWithString:text scanInt:&value; return (value > 0); } Beware, though, that this will crash with a non-numeric value. Better version, with error handling... this assumes that you want a false value for non-numerics: - (BOOL)valueGreaterThanZero:(UILabel *)label { NSString *text = label text; int value; BOOL gotNumber = NSScanner scannerWithString:text scanInt:&value; return (gotNumber && value > 0); } Then, to use in an if statement, as per OP, if (self valueGreaterThanZero:labelToCheck) ...

– pixelbitlabs Dec 2 at 18:06 this error appears: pastie. Org/2956098 – pixelbitlabs Dec 2 at 18:13 You've got a problem with an 'isEqualToString:(NSString *)' call, which I didn't provide in my code. Fix that and then try my code again.

Also, the way I'd probably implement this is to sub-class UILabel and add the function above to the sub-class. Then (assuming 'myLabel' is an instance of that sub-class), you could do this if (myLabel valueGreaterThanZero).... Of course, to do this, you'd change the function signature to remove the :(UILabel *)label portion.So, the final signature would be - (BOOL)valueGreaterThanZero. – mbm30075 Dec 3 at 21:09.

If (myLabel. Text intValue > 0) { // do staf }.

This error appears: pastie. Org/2956098 – pixelbitlabs Dec 2 at 18:13 Please post your code. – taskinoor Dec 2 at 18:26.

2 That statement will evaluate as true for any non-nil label text. NSString * cannot usefully be cast to int. – Noah Witherspoon Dec 2 at 18:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions