0

Trying to do two things:

When I add the line break \n, all it does is stop any text after to show. So it just shows "Name of Branch" (see below) and then nothing else. I'm looking for the absolute easiest implementation.

"VBAnnotation.h" file:

 @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" file:

  #import "VBAnnotation.h"

  @implementation VBAnnotation

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

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

In my 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];
Michael Sebastian
  • 785
  • 3
  • 15
  • 33
  • Why not ask who ever wrote the `VBAnnotation` class? – rmaddy Jan 12 '16 at 15:46
  • There are multiple ways to input a line break, I was hoping to find the absolute easiest approach. Anyone else want to try and actually be helpful? – Michael Sebastian Jan 12 '16 at 15:52
  • You missed my point. `VBAnnotation` is not a standard class. It is some custom class written by you or some third party. Therefore, no one here is likely going to be able to help. – rmaddy Jan 12 '16 at 15:55
  • Code updated to show custom class. I think I found my answer anyway. http://stackoverflow.com/questions/2459265/nsstring-with-n-or-line-break. – Michael Sebastian Jan 12 '16 at 16:14
  • I'm guessing the numberOfLines property on whatever UILabel this is going to is set to 1 which won't allow multiple lines – MobileMon Jan 12 '16 at 16:54

0 Answers0