Objective-C警报标题行中断不起作用

时间:2016-01-12 15:39:08

标签: ios objective-c mapkit uialertview

尝试做两件事:

当我添加换行符\ n时,它所做的只是停止显示之后的任何文本。 所以它只显示“分支的名称”(见下文),然后没有别的。我正在寻找最简单的实施方案。

“VBAnnotation.h”文件:

 @interface VBAnnotation : NSObject <MKAnnotation>
 @property (nonatomic, assign) CLLocationCoordinate2D coordinate;
 @property (nonatomic, copy) NSString *title;
 @property (nonatomic, copy) NSString *subtitle;

 - initWithPosition:(CLLocationCoordinate2D)coords;

 @end

“VBAnnotation.m”文件:

  #import "VBAnnotation.h"

  @implementation VBAnnotation

  @synthesize coordinate;
  @synthesize title;
  @synthesize subtitle;

- initWithPosition:(CLLocationCoordinate2D)coords {
if (self = [super init]) {
    self.coordinate = coords;
}
return self;
}
@end

在我的ViewController中:

CLLocationCoordinate2D walnut;
walnut.latitude = WALNUT_LATITUDE;
walnut.longitude = WALNUT_LONGITUDE;
VBAnnotation *branch = [[VBAnnotation alloc] initWithPosition:walnut];
[branch setCoordinate:walnut];
branch.title = @"Name of Branch \n More Info on Branch"; ### adding line break
branch.subtitle = @"This is where the address will go";
branch.customTitle = @"Another custom title to "; ### is this possible?
[self.mapView addAnnotation:branch];

0 个答案:

没有答案