How to 开发者_如何学JAVAconvert Float64
to NSString
in objective-c?
How about this:
NSString *str = [NSString stringWithFormat: @"%lf", number];
You can also use
NSString *str = [[NSString alloc] initWithFormat: @"%lf", number];
Edit:
The difference is that you need to release
the str
variable in this case when you are done with it. We use init
method to initialize class variables so that they can be accessible across the class and then release them in dealloc
.
精彩评论