1

I am using two DatePicker in CustomViewController and after calculating get the value of difference between two dates.which is calculated .now in another controller I have to put date value into a label.

Value in label should be in integer form.but what I have to do is if the value is <=5 days then it should be show in red color, if value is <=8 days then it should be in yellow and finally if >=8 then green color should be appear in label.

So I am not getting that how I put conditional statement so I can move on.I already done calculation part.

Here is my code where I get this warning:

int i = 5;
if (cell.lblDate.text <=i) {
    cell.lblDate.textColor = [UIColor redColor];
}
JAL
  • 41,701
  • 23
  • 172
  • 300
JohnWick
  • 241
  • 2
  • 13
  • There is no such thing as "order" between an integer and a pointer. If you want to do that comparison, compare to `cell.lblDate.text.integerValue`. – Hot Licks Dec 30 '13 at 12:04
  • (And *please* spend a little more time learning basic C before continuing with Objective-C. You're going to develop some expensive bad habits and misconceptions if you don't.) – Hot Licks Dec 30 '13 at 12:05

1 Answers1

0

Try this

int i = 5;
if ([cell.lblDate.text  integerValue] <= i) {
    cell.lblDate.textColor = [UIColor redColor];
}
Mani
  • 17,549
  • 13
  • 79
  • 100
  • Thanks brother ..can you help me for one thing also...please – JohnWick Dec 30 '13 at 12:11
  • Yes. ask your question by updating your question? – Mani Dec 30 '13 at 12:14
  • http://stackoverflow.com/questions/20800108/application-run-on-simulator-but-not-on-device-in-iphone please check this link i have tried so many time but no one understood that my application is running perfectly on simulator but not on device its crash please suggest – JohnWick Dec 30 '13 at 12:46