I’m not sure what’s going on here. For some reason NSString seems unwilling to load in the double value d.
Here’s my code:
-(NSString*)minuteFormat:(double) d{
NSString* mystring;
if(d >= 10){
mystring = [NSString stringWithFormat:@"%d", d];
}else{
mystring = [NSString stringWithFormat:@"0%d",d];
}
return(mystring);
}
Regardless of the value of d, the only thing that’s getting returned is 0 or 00. (And I’m sure d is getting inputted correctly, as I’ve used breakpoints to check.)
Could someone tell me what’s going on?
%dis for integers. You probably want%f. See String Format Specifiers