Tag: 注释

NSMutableArray NSData转换使用NSUserDefaults

如下所示的代码,它不会让我回到我的可变数组。 我在我的可变数组中有3个注释,但是一旦我closures我的应用程序并再次打开它,就会显示我0个对象。 我不知道为什么我正在获取O对象,而我回来我的arrays! 任何想法? -(void)viewDidLoad { NSUserDefaults *ud=[NSUserDefaults standardUserDefaults]; if([ud boolForKey:@"save-exist"]) { NSMutableArray *udAnnotations=[[NSMutableArray alloc]initWithArray: [ud objectForKey:@"annotationsArray"]]; NSLog(@"%d",[udAnnotations count]); } else { [self addAnno]; } } -(void)addAnno { [mapView addAnnotations:annotationArray]; NSUserDefaults *ud=[NSUserDefaults standardUserDefaults]; [ud setObject:annotationArray forKey:@"annotationsArray"]; [ud setBool:YES forKey:@"save-exist"]; [ud synchronize]; }

viewForAnnotation没有移动userLocation

我已经实现了- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {方法来更改userLocation Annotation的默认位置。 在这个方法里面我使用了: if (annotation==(mapView.userLocation)) { MKAnnotationView *myAnotation = [[MKAnnotationView alloc] init]; myAnotation.image = self.userPointImage.image; myAnotation.centerOffset = CGPointMake(0, 250); return myAnotation; } else { return nil; } 其中成功将默认userLocation注释移动到中心底部。 但是,因为我也在使用标题,所以当移动我的手机时,它仍然从中心旋转地图。 – (void)locationManager:(CLLocationManager *) manager didUpdateHeading:(CLHeading *) newHeading { [self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:true]; } 但userLocation注释如下。 那么该怎么做? UPDATE 我发现这个问题,并尝试应用它。 但是,因为我正在使用标题,所以它崩溃的应用程序。 在我的didUpdateUserLocation方法中,我添加了[self moveCenterByOffset:CGPointMake(0, 200) from:userLocation.coordinate]; […]

如何获得Mapkit的注释索引?

如何获得Mapkit注释索引? 我尝试到目前为止… 在ViewDidLoad这样… [self.mapView addAnnotations:[self createAnnotations]]; 在CreateAnnotations这样的…. – (NSMutableArray *)createAnnotations { NSMutableArray *annotations = [[NSMutableArray alloc] init]; //Read locations details from plist NSString * path = [[NSBundle mainBundle] pathForResource:@"locations" ofType:@"plist"]; NSArray * locations = [NSArray arrayWithContentsOfFile:path]; NSDictionary * imageDic; customTickLocations = [NSMutableArray new]; for (NSDictionary *row in locations) { NSNumber *latitude = [row objectForKey:@"latitude"]; NSNumber […]

在parsing查询中添加mapview注释将随机返回null

我正在使用Parse数据库(asynchronous)创build一个iOS应用程序来存储将在填充mapview时使用的信息。 我一直在努力弄清楚什么是错误的,并且没有任何运气做了大量的研究。 但是,我发现了这个问题的根源。 在我的代码中,我正在查询parsing数据库,希望获取我想要的信息,然后将信息存储在types为MkPointAnnotation的自定义pointAnnotation类中。 每个项目都存储在一个pointAnnotations数组中,一旦数据库中的所有项目都存储在数组中,则注释将被添加到MyMapView。 – 我尝试添加注释,因为它们被创build,这不会改变任何东西。 我遇到的问题是,随机查询将在for(PFObject * vendor in Vendors)下进行迭代,并出现错误,调用NSLog(@“%@”,error.debugDescription); 在输出日志中显示(空)。 每次运行应用程序时,返回null对象的数量似乎都会改变,偶尔会按预期工作。 在添加do while(pointArray.count <query.countObjects)之后,函数将迭代大约20-30次,然后添加正确数量的注释,但效率非常低。 这是Parse内的低效率还是有更好的方法来实现预期的结果? PFQuery *query = [PFQuery queryWithClassName:@"Vendors"]; [query orderByDescending:@"updatedAt"]; [query findObjectsInBackgroundWithBlock:^(NSArray *vendors, NSError *error){ NSMutableArray *pointArray = [[NSMutableArray alloc] init]; if (!error) { // The find succeeded. // Do something with the found objects do { pointArray = [[NSMutableArray […]

无法select注释?

我在地图视图上有一个注释。 我可以select它,但是我点击它没有任何反应。 你可以帮帮我吗? 有没有人遇到类似的问题? 这里是build立阴谋的方法: – (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { MKAnnotationView *aView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"MapVC"]; if (!aView) { aView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"MapVC"]; aView.canShowCallout = YES; aView.draggable=YES; aView.leftCalloutAccessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)]; // could put a rightCalloutAccessoryView here } aView.annotation = annotation; [(UIImageView *)aView.leftCalloutAccessoryView setImage:nil]; return aView; } 并将它们添加到地图视图: – […]

iOS Mapkit – 注解在地图滚动/缩放中消失

在初始加载时,注释显示得很好。 但是,如果我滚动地图,它们都消失了,代码只被调用用户位置,而不是viewForAnnotation委托方法中的其他注释。 绘制引脚 -(void)viewDidLoad{ …Download Coordinates and Data from Web here… [self.mapView addAnnotation:pin]; } 委托方法 – (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { //Player's Pin if([annotation class] == MKUserLocation.class) { return nil; } //Cluster Pin if([annotation isKindOfClass:[REVClusterPin class]]){ REVClusterPin *pin = (REVClusterPin *)annotation; if( [pin nodeCount] > 0 ){ pin.title = @"___"; MKAnnotationView *annotationView = (REVClusterAnnotationView*)[mapView […]

我可以以编程方式将链接注释添加到PDF中吗?

我正在制作一个使用UIWebView来显示PDF的iPad应用程序。 我有一个PDF,我想以编程方式添加链接。 为了简单起见,可以说有10个段落。 他们都编号,并在其中有几行文字。 我想能够以某种方式添加到PDF的基本链接,以便如果第2段被触摸,那么我的UIWebView可以处理与段落2相关联的请求。 我不知道里面的PDF结构是什么样的。 我不知道如何把这个扩大到几百页的每一段。 但我想知道如果我可以添加一个链接或HTML到PDF,以便我可以操纵它与我的应用程序。 谢谢! 要清楚的是,我正在iOS设备上查看这个PDF,但是我认识到我的问题的解决scheme可能与Cocoa-touch框架没有任何关系。 我正在寻找任何types的解决scheme,将允许我添加到我的PDF的某些领域的不可见链接。

如何通过点击iOS中的特定注释来获取值?

我有我的应用程序中的地图视图和2个文本框。 两个文本框都显示经纬度。 我在地图视图中绘制或映射了几个注释,当单击每个注释时,标注将显示相应的经度和纬度值。 我只想在我的文本框中显示这些纬度和经度值。 我试了下面的代码, latitude_value.text=myAnnotation.title; longitude_value.text=myAnnotation.subtitle; latitude_value和longitude_value是文本框 myAnnotation是注释名称 标题和副标题包含经度和纬度值。 提前致谢…!

更新MapKit注释字幕和图像

我在网上search了一下,发现了一些关于如何做我想做的事情的想法,但是我仍然想知道你应该怎么做。 这里是上下文: 我正在为iOS 5开发一个应用程序。我使用MapKit来显示地图,并且为它添加​​了大约5000个注释 – 好像很多,但是不用担心,我使用了一个聚类库:)。 为了在用户每次打开地图时不加载它们,我在我的appDelegate中创build它们(我创build了一个批注数组,并调用[_mapView addAnnotations:[appDelegate.annotationsToAdd allObjects]];当我打开地图时)。 创buildannotationsToAdd数组大约需要10秒左右的时间,所以我认为这个解决scheme工作的非常好(你必须等待10秒才能被授权打开地图,但是你只需等待一次,在应用程序启动的时候)。 在每个注释中,我都有一个“链接”到一个对象,其中包含一个值的数组(15浮点数)。 现在,当我创build注释时, subtitle方法返回其中的一个值。 在我的地图的ViewController中,我有2个分段控件。 第一个有3个段,第二个有5个,它给出了15个组合 – 又一次,这是我的注释中对象的数组具有相同数量的值:)。 所以你可能已经看到我的问题来了,我想更新我的地图上的每个注释的字幕(即使群集中的每个注释的字幕,因为群集基于它所持有的引脚给出平均值)。 我也想要的是更新annotationView的颜色/图像基于注释的副标题的值。 我可能是错的,但基于我的研究,我明白,你必须删除所有的注释,并重新创build所有这些。 你明白这不是我的select。 每次他改变其中一个控件的值时,我都不能让用户等待10秒钟。 我看到一篇关于KVO的文章:这可能是一个有效的解决scheme吗? 我不太了解NSNotification,但是我应该使用它们吗? 我真的很感谢你的帮助,我更希望得到一个详细的答案,告诉我在我显然不常见的情况下要遵循的步骤。 提前致谢。

这是什么Objective-C / XCode批注//

查看iOS上GCM通知的示例代码: https : //github.com/googlesamples/google-services/blob/master/ios/gcm/GcmExample/AppDelegate.m#L31 …. // [START register_for_remote_notifications] – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // [START_EXCLUDE] …. // [END_EXCLUDE] // [START_EXCLUDE] // [END_EXCLUDE]的用途是什么? 它是一个约定的一部分,是Objective C的一部分还是xCode的一部分?