select器来获取indexPath UICollectionView Swift 3.0

我试图获得两次点击单元格上的indexPath 。 我在这样的Selector传递参数,但它给错误。 这是什么正确的格式? func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if let subOptioncell : SubOptionsCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: subOptionsCVReuseIdentifier, for: indexPath) as! SubOptionsCollectionViewCell let imageNamed = "\(customizeOptionSelected[indexPath.row])" subOptioncell.subOptionsImage.image = UIImage(named: imageNamed) let tap = UITapGestureRecognizer(target: self, action: #selector(doubleTapped(sender: indexPath))) tap.numberOfTapsRequired = 2 collectionView.addGestureRecognizer(tap) return subOptioncell } } func doubleTapped(sender: IndexPath) { print("Double […]

iOS后台提取自定义时间间隔

我读了所有有关后台获取的Apple文档,目前我正在使用它: [[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:minimumBackgroundFetchInterval]; 我让OS决定何时执行后台获取,但如果我这样设置: [[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:21600]; 这是否意味着每6个小时会发生一次?

相对于其他dynamic体移动一个dynamic体

我遇到了一些我找不到解决scheme的问题。 我有摇摆的平台(body1)和英雄(body2)站在上面。 平台摇摆,所以英雄在平台上左右移动。 一开始我要英雄站在平台上而不改变它相对于平台的地位。 我通过joinSKPhysicsJointFixedjoin平台和英雄。 那么在游戏的某个时刻,我希望英雄跑在平台上,这意味着Y应该和平台保持一致,而X应该会增长。 我find的唯一解决scheme是使英雄身体静态,并改变它在didSimulatePhysics的位置。 那种方法的问题是那个位置没有准确地改变。 与平台位置相比,英雄位置落后于一个框架。 英雄到达平台右端后,他应该停止移动,然后再站在平台上。 所以我让英雄身体静止,再加上固定的关节。 而且由于英雄位置的变化与英雄相对平台的位置不正确有关。 有时它会停止平台表面以下的某些像素,有时会停止平面上方的某些像素。 那么有没有其他的方法可以让英雄沿着平台移动,英雄身体应该始终保持dynamic。

支持iOS 4.3到iOS 6.0

我已经有了支持ios 4.3到ios 5的基本代码。现在我也想支持ios 6.0。 目前的基本代码具有modal views ,硬编码的CGRect's ,并且每个视图的旋转是不同的。 所以我想知道我们是否可以用相同的基本代码支持ios 4.3到ios 6.0,只需调整一些更改,还是需要创build一个完整的新目标? 就像我们不能使用ios 6.0的自动布局,如果我想支持以前的版本,因为它会导致崩溃。

如何将audio效果应用于文件并写入文件系统 – iOS

我正在构build一个应用程序,允许用户将audiofilter应用于录制的audio,如混响,增强。 我无法find有关如何将filter应用于文件本身的任何可行的信息源,因为需要稍后将处理的文件上载到服务器。 我目前正在使用AudioKit进行可视化,而且我知道它可以进行audio处理,但只能用于播放。 请提供进一步研究的build议。

特殊字符JSON iOS SQLite

我有一个问题。 我从JSON获取信息,他返回我无效的字符。 JSON给我这个:“27 /”“当我需要这个:27”。 我知道这是一个特殊字符的编码,但是当我使用NSString的值在SQLite表中创build一个插入,我不能使用27 /“原因插入格式是这样的:INSERT INTO FORMATOS(ID,NOMBRE)VALUES (“17”,“27”“)。 我需要什么方法在SQLlite中正确插入信息? for (int i = 0; i<idFormato.count; i++) { NSString *idStr = [idFormato objectAtIndex:i]; NSString *nameStr = [nameFormato objectAtIndex:i]; insertSQL = [NSString stringWithFormat:@"INSERT INTO FORMATOS (ID, NOMBRE) VALUES (\"%@\", \"%@\")", idStr, nameStr]; //Char constant with the query encoded un UTF const char *insert_stmt = [insertSQL UTF8String]; […]

如何在iOS8中将通知types从Banner更改为Alert?

我试图创build一个应用程序,提供本地通知作为一个警报,而不是一个横幅。 但看起来像横幅是默认的,我无法find一种方法来改变我的代码。 我可以改变它的应用程序通知设置,它完美的作品,但我希望这种configuration是默认的。 这是我用来请求用户发送通知的权限的代码: UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings]; (顺便问一下,有人知道为什么我不能用这个代码设置图标徽章?) 这是我用来创build本地通知的代码: UILocalNotification* localNotification = [[UILocalNotification alloc] init]; localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:segundosTotal]; localNotification.alertBody = timer.nome; localNotification.soundName = @"Default-28-sec-192kbps.mp3"; localNotification.timeZone = [NSTimeZone defaultTimeZone]; [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 有了这个代码,我得到了默认的横幅通知,我怎样才能把它更改为提醒?

我的iPhonevideo只能在肖像模式下播放

我正在使用MPMoviePlayerController播放电影。 电影以纵向模式启动(因为这是应用程序使用的唯一模式),即使设备旋转,也会保留在那里。 我从来没有明确设置shouldAutoRotateetc。 function来响应风景和肖像,因为我不希望我的意见resize。 有没有办法让video响应肖像和风景旋转? 任何帮助将不胜感激。 仅供参考:这是我的代码 NSString *filepath = [[NSBundle mainBundle] pathForResource:@"TestMovie" ofType:@"m4v"]; NSURL *fileURL = [NSURL fileURLWithPath:filepath]; MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL]; //Listen so we can clean up after the movie is over [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController]; [self.view addSubview:moviePlayerController.view]; [moviePlayerController setFullscreen:YES animated:YES]; [moviePlayerController play];

单击第一个ViewController中的button,更改第二个ViewController的标签文本

我是Swift和iOS开发新手。 我目前有2个ViewControllers ,第一个button和第二个label 。 我已经将第一个button连接到第二个ViewController并且转换工作。 现在,当我尝试更改标签的文本时,出现错误: 致命错误:意外地发现零,而解包一个可选值 。 在这里,您可以在第一个ViewControllerfind我的准备function: override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "mySegue" { let vc = segue.destination as! SecondViewController vc.secondResultLabel.text = "Testing" } } 第二个ViewController中的标签是否可以被保护? 谢谢您的帮助

如何使用Facebook iOS SDKpipe理生产和开发凭证

症状 我的应用程序使用Facebook来让用户login。它在从XCode进行debugging和通过AdHoc部署进行testing时工作正常,为了让外部testing人员提交我们的应用程序供审阅,但似乎Facebook在OAuth进程中抱怨“应用程序不是安装程序:这个应用程序的开发人员还没有正确设置这个应用程序的Facebooklogin“。 假设 XCode中的目标info部分中的Custom iOS target properties中的FacebookDisplayName和FacebookAppId与Facebook应用程序开发版本相匹配。 不知何故,SDK必须检测到,在审查过程中,应用程序不再在开发中,并发生错误。 题 如何在这个目标中Custom iOS target properties一些具有不同release和debug值的Custom iOS target properties ?