Issue
I am working on mapView project. My project will take only 5 annotations on the map. Once new annotation will be added, then first annotation will be drop. I am keeping all annotations latitude and longtitude into NSMutableStringArray. Is there any short way to implement this round robin fashion. First in last out.
for example my nsmutable string:
[12.99, 35.97: 35.85,94.53: 45.44,98.91]
How could I delete first object (each string separated by column operator :) from the string to acquire the following:
[35.85,94.53: 45.44,98.91]
Solution
I have got it work, my solution is below:
NSMutableString *absolute=[NSMutableString stringWithString:pinPoints];
NSLog(@"before absolute: %@",absolute);
NSArray *placemarks=[absolute componentsSeparatedByString:@":"];
if([placemarks count]>5)
{
//NSLog(@"%@",[placemarks objectAtIndex:0]);
NSMutableString *string1 = [NSMutableString stringWithString: [placemarks objectAtIndex:0]];
[absolute replaceOccurrencesOfString:string1 withString:@"" options:0 range:NSMakeRange(0,[pinPoints length])];
pinPoints=absolute;
}
NSLog(@"after absolute: %@",absolute);
Answered By - user1724168
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.