缩放后MKMapview注解dynamicpin图像发生变化

我正在研究一个在地图上显示7种不同types的注释的小项目。 我的注释取自数组中的url结果,并使用JSONparsing。 我有很多的注释,一旦地图加载,一切似乎都很好看。 在放大和缩小之后,针图像由于某种原因而改变为错误的针图像(具体图像,不知道为什么)。 我相信我在这里失去了一些东西…你可以请帮助:)? 这里是我的代码的一部分,让我知道如果你需要它了: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{ static NSString *identifier; if(_mapView.tag==1){identifier = @"TurbulencePin";} if(_mapView.tag==2){identifier = @"IcingPin";} if(_mapView.tag==3){identifier = @"WindsPin";} if(_mapView.tag==4){identifier = @"TemperaturePin";} if(_mapView.tag==5){identifier = @"CloudsPin";} if(_mapView.tag==6){identifier = @"VisibilityPin";} if(_mapView.tag==7){identifier = @"MultiplePin";} if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; if ([annotation isKindOfClass:[Annotation class]]) { CustomAnnotationView* annotationView = (CustomAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; annotationView = nil; if (annotationView […]

IOS Customkeyboard。 如何在自定义键盘中设置特殊字符

我正在为iPhone 6和6Plus的自定义键盘工作。 我已经开发了Shift键active – inactive或123和abc键的逻辑。 但我也想显示自定义的符号,如苹果键盘显示。 请检查图像。 目前我可以将大写更改为小写,123更改为abc,但是如何设置此特殊字符。 注: – 我在github上search了很多演示,但是我无法在任何自定义键盘中看到特殊字符。 这是我的大写和ABC-123button的逻辑。 -(void)UpparCase:(UIButton*)sender // To make caps or small letter { sender.selected=!sender.selected; if(sender.selected) { if(isPortrait) { [self.ObjKeyLayout.btnCapKey setBackgroundImage:[UIImage imageNamed:@"upparActive.png"] forState:UIControlStateNormal]; } else { [self.ObjKeyLayout.btnCapKey setBackgroundImage:[UIImage imageNamed:@"Uppar_selctd_land.png"] forState:UIControlStateNormal]; } for(UIButton *key in self.ObjKeyLayout.ArryCharKey) { NSString *uppercaseString = [[key currentTitle] uppercaseString]; [key setTitle:uppercaseString forState:UIControlStateNormal]; [key addTarget:self action:@selector(pressKey:) […]

当iOS应用程序在后台时,GCM推送通知

我正尝试使用GCM将推送通知发送到我的iOS应用程序。 应用程序在后台收到通知时不会收到通知,但会在前台收到通知。 我正在使用PHP脚本testing推送通知,该脚本也将消息直接发送到APNS,并在后台工作。 发送给GCM的JSON :(我从一个rest客户端发送来进行testing) { "to" : "token…", "notification" : { "title": "GCM TITLE", "body" : "FROM GCM", "badge": "1", "sound": "default" } } 不工作 :在didReceiveRemoteNotification中从GCM收到的userInfo: Notification received: [aps: { alert = { body = "FROM GCM"; title = "GCM TILE"; }; badge = 1; sound = default; }, gcm.message_id: 123…] 工作 :从PHP脚本发送时收到的userInfo(我也将message_id添加到JSON,看看是否是这个问题) Notification […]

#ifdef #else #endifselectiOS sdk版本和function?

我正在build立一个黑暗主题的iOS 6和7应用程序。 我明白我可以调用[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 使iOS 7状态栏适合深色主题应用程序。 问题是我要把我的应用程序提交到App Store,而且目前Xcode 5还没有准备好,所以我必须使用Xcode 4.6.x来完成这个任务。 但是,使用Xcode 4.6,我无法从iOS 7编译新的方法。我想我必须做一些像“”如果ios7“”然后做[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 并重新定位我的应用程序窗口。 我正在试图用#ifdef … #else …这个代码是[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 里面的viewDidLoad 。 任何人都可以帮助理解如何在一些函数中使用#ifdef …方法。 非常感谢!!!!

cordova3.1.0:找不到插件或不是CDVPlugin

我试图build立我的第一个cordova应用程序,我不能得到一个插件工作。 我的应用程序是使用Cordova命令行界面构build的,所以我已经用这种方式添加了Camera插件: cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git 我的config.xml如下所示: <?xml version='1.0' encoding='utf-8'?> <widget id="com.dev.myapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>My App</name> <description> A sample Apache Cordova application </description> <author email="dev@callback.apache.org" href="http://cordova.io"> Apache Cordova Team </author> <content src="index.html" /> <access origin="*" /> <preference name="fullscreen" value="true" /> <preference name="webviewbounce" value="true" /> <feature name="Camera"> <param name="ios-package" value="CDVCamera" /> </feature> </widget> 我已经运行cordova build […]

表视图didSelectRowAtIndexPath,仅在select第二次点击后才起作用

我有一个表格视图,我已经configuration,以便当用户点击该行时,它将移动到一个新的视图基于特定单元格的名称。 然而,当我第一次点击一个单元格时,它什么都不做,当我点击下一个单元格时,就像我点击了第一个单元格一样。 例如,我有头盔,手杖和手套。 如果我按头盔,没有任何反应。 然后,如果我按下Stick,它会为头盔做didSelectRowAtIndexPath,而不是Stick。 任何build议为什么发生这种情况? //Tapping to change on row – (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; NSLog(@"%@", cell.textLabel.text); if([cell.textLabel.text isEqualToString:@"Helmet"]) { [self performSegueWithIdentifier:@"toHelmetView" sender:indexPath]; } } //Segue control, fetch helmet and send it – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"toHelmetView"]) { // Fetch the selected object //EquipmentCategory *o […]

CoreData Stack适用于Swift中的iOS 9和iOS 10

我正在尝试将Core Data添加到支持iOS 9+的现有项目中。 我添加了由Xcode生成的代码: // MARK: – Core Data stack lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: "tempProjectForCoreData") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("Unresolved error \(error), \(error.userInfo)") } }) return container }() // MARK: – Core Data Saving support func saveContext () { let […]

用EKEvent在iPhone中播放闹钟

我正在使用EKEvent类存储事件的应用程序,我希望我的应用程序在发生事件时触发警报。 我不知道如何在iPhone上播放闹钟。

如何在目标c中创build自定义exception?

我试图在目标c中实现这样的目标。 @try{ //some code that will raise exception } @catch(CustomException e){//How to create this //catching mechanism } @catch(NSException e){ //Generic catch } 我需要创buildCustomException类并使用它。 你能帮我创build这个CustomException并指导我如何使用这个。 提前致谢。

iPhone中textfieldshouldendediting和textfieldDidendediting之间的区别

textFieldShouldendEditing和textfieldDidEndEditing之间有什么区别,什么时候应该使用每个方法?