I want calculate this operation with Xcode:
A*B*(DAYS)=R
DAYS= How many days are from past datepicker to today.
Today is the date setting of the iPhone. eg:
5*5*10
10= Days between yesterday and today.
THIS IS MY SITUATION:
my H
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextField *a;
@property (strong, nonatomic) IBOutlet UITextField *b;
@property (strong, nonatomic) IBOutlet UILabel *r;
@property (strong, nonatomic) IBOutlet UIButton *result;
@property (strong, nonatomic) IBOutlet UIDatePicker *data;
@end
my M
- (IBAction)calculate:(id)sender {
NSDate *past = _data.date ;
NSDate *now =[NSString stringWithFormat:@"%@",nil];
**float z = HOW MANY DAYS BETWEEN PICKER AND TODAY;** //this is a example
float a = ([a.text floatValue]);
float b = a*([b.text floatValue]);
float r= a*b*(z.text float);
_result.text = [[NSString alloc]initWithFormat:@"%2.f",b];
}
I know that this is Wrong method….Can you help me?
You are computing number of days, so you can just use
intinstead offloat.