How to print object variable?
How do I print the value of -> event.latitude = [[values objectAtIndex:0] floatValue]; ?
Below is some of my code:
@interface SeismicEvent : NSObject <MKAnnotation>{
float latitude;
float longitude;
**This is an object
SeismicEvent *event;
** This reads in a float
event.latitude = [[values objectAtIndex:0] floatValue];
How do I print out event.latitude?
I tried NSString *str = [NSString stringWithFormat:@"%@", event开发者_如何学JAVA.latitude];
Thanks guys.
Try this
NSString *str = [NSString stringWithFormat:@"%f", event.latitude];
Notice the format string
If you're just trying to print it out, why not try:
NSLog(@"%f", event.latitude);
精彩评论