Ios 目标C警报标题行中断不工作
尝试做两件事: 添加换行符\n时,它所做的只是停止显示后的任何文本。 因此,它只显示“分支名称”(见下文),然后不显示其他内容。我正在寻找绝对最简单的实现 “VBAnnotation.h”文件: 在我的ViewController中:Ios 目标C警报标题行中断不工作,ios,objective-c,mapkit,uialertview,Ios,Objective C,Mapkit,Uialertview,尝试做两件事: 添加换行符\n时,它所做的只是停止显示后的任何文本。 因此,它只显示“分支名称”(见下文),然后不显示其他内容。我正在寻找绝对最简单的实现 “VBAnnotation.h”文件: 在我的ViewController中: CLLocationCoordinate2D walnut; walnut.latitude = WALNUT_LATITUDE; walnut.longitude = WALNUT_LONGITUDE; VBAnnotation *branch = [[VBAn
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];
为什么不问问谁编写过
VBAnnotation
类?有多种方法可以输入换行符,我希望找到最简单的方法。还有其他人想帮忙吗?你没领会我的意思<代码>VBAnnotation不是标准类。它是由您或某些第三方编写的自定义类。因此,这里可能没有人能够提供帮助。代码更新为显示自定义类。我想我还是找到了答案。我猜无论UILabel上的numberOfLines属性将被设置为1,这将不允许多行
#import "VBAnnotation.h"
@implementation VBAnnotation
@synthesize coordinate;
@synthesize title;
@synthesize subtitle;
- initWithPosition:(CLLocationCoordinate2D)coords {
if (self = [super init]) {
self.coordinate = coords;
}
return self;
}
@end
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];