AppKit에서 mapview로 작업하고 있습니다. 필자는 도청 될 때 텍스트가있는 주석을 표시하는 핀이있는지도를 가지고 있습니다. 끈이 너무 길면, 털이 끊어집니다.AppKit의지도 뷰에서 어노테이션의 긴 문자열을 어떻게 감쌀 수 있습니까?
줄 바꿈 대신 텍스트를 다음 줄로 바꾸고 싶습니다.
다음은 코드입니다.
.m에서 .h를 가져 오면 .h에서 물건을 합성합니다. 나는 또한 여기에 문자열을 만듭니다. 여기에 높이를 지정하는 변수를 만들 수 있습니까? 아니면 단어 감싸기를 허용하는 속성이 있습니까?
#import "AdoptingAnAnnotation.h"
@implementation AdoptingAnAnnotation
@synthesize latitude;
@synthesize longitude;
@synthesize coordinate;
- (id) initWithLatitude:(CLLocationDegrees) 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
그리고 뷰 컨트롤러에서. 여기에 속성을 적용합니까?
AdoptingAnAnnotation *museumTaxiAnnotation = [[[AdoptingAnAnnotation alloc] initWithLatitude:41.891036 longitude:-87.607663] autorelease];
[myMapView addAnnotation:museumTaxiAnnotation];
도와주세요! 정말로 xCode에 대한 새로운 내용이고 다소이 프로젝트에 돌입했습니다.
난 그냥 내 문자열을 단축 감아 ... –