I am working with the mapview in AppKit. I have a map with pins which, when tapped, bring up an annotation with text in them. When the strings are too long, they cut off with elipses.
I'd like to make the text wrap to the next line instead of cutting off.
Here is the code.
In the .m I import the .h, synthesize the stuff from the .h. I also create the strings here. Would I create variable here that I assign the height to? Or is there a property which allows me to word wrap?
#import "AdoptingAnAnnotation.h"
@implementation AdoptingAnAnnotation
@synthesize latitude;
@synthesize longitude;
@synthesize coordinate;
- (id) initWithLatitude:(CLLocation开发者_如何学编程Degrees) lat longitude:(CLLocationDegrees) lng
{
latitude = lat;
longitude = lng;
return self;
}
- (CLLocationCoordinate2D) coordinate
{
CLLocationCoordinate2D coord = {self.latitude, self.longitude};
return coord;
}
- (NSString *) title
{
return @"Some Text";
}
- (NSString *) subtitle
{
return @"Some More Text, a bunch of it, a niiiiice long string. Some More Text.";
}
@end
and then in the view controller. Do I apply some attribute here?
AdoptingAnAnnotation *museumTaxiAnnotation = [[[AdoptingAnAnnotation alloc] initWithLatitude:41.891036 longitude:-87.607663] autorelease];
[myMapView addAnnotation:museumTaxiAnnotation];
Please help! Im really new with xCode and kinda got rushed into this project.
You'll have to create your own view controller for the popover and use that when displaying. This question should help you:
How do I display a UIPopoverView as a annotation to the map view? (iPad)
精彩评论