开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜