Swift将audio和video文件合并为一个video

我在Swift中编写了一个程序。我想将一个video与一个audio文件合并,但是得到了这个错误。 “失败错误域= AVFoundationErrorDomain代码= -11838”停止操作“UserInfo = 0x17da4230 {NSLocalizedDescription =操作已停止,NSLocalizedFailureReason =操作不支持此媒体} 码 func mergeAudio(audioURL: NSURL, moviePathUrl: NSURL, savePathUrl: NSURL) { var composition = AVMutableComposition() let trackVideo:AVMutableCompositionTrack = composition.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: CMPersistentTrackID()) let trackAudio:AVMutableCompositionTrack = composition.addMutableTrackWithMediaType(AVMediaTypeAudio, preferredTrackID: CMPersistentTrackID()) let option = NSDictionary(object: true, forKey: "AVURLAssetPreferPreciseDurationAndTimingKey") let sourceAsset = AVURLAsset(URL: moviePathUrl, options: option as [NSObject : AnyObject]) let audioAsset = […]

iOS UIScrollView取消滚动上的UIButton触摸

我有一个UIScrollView UIButtons,但我不想延迟button触摸。 但是,只要滚动视图检测到拖/滚动,我想要取消UIButton触摸并继续滚动的UIScrollView。 我已经包括以下… _scrollView.delaysContentTouches = NO; …但(显然)button触摸不会取消拖动时。 有没有人有任何build议,我可以如何实现这个function?

XCode 6.3.1在重命名项目时崩溃

我使用Xcode 6.3.1开发iOS游戏,使用cocos2dx 2.2.6。 我需要更改我的iOS应用程序的名称。 我曾经这样做,点击XCode中的项目后按回车键。 这将打开一个对话框,确认您想要在项目中更改名称的位置。 前两天我更新Xcode,现在当我按下input更改项目的名称,它打开对话框,突然崩溃。 如果任何人可以find一个替代方法来更改我的iOS项目的应用程序名称,我将不胜感激。 谢谢

在iOS中沿着path均匀地绘制图像

我想要做的就是在屏幕上移动我的手指(touchesMoved)并沿touchesMoved生成的点绘制均匀间隔的图像(可能是CGImageRefs)。 我可以画线,但是我想要生成的东西看起来像这样(对于这个例子,我使用的是一个箭头的图像,但它可能是任何图像,可能是我的狗的图片:))主要的是当用iPhone或iPad上的手指进行绘图时,图像均匀分布。

表格视图控制器的多个部分

我有一个小的应用程序,使用多个部分布局的初始表视图。 一个部分显示来自Twitter的最新趋势,另一个部分显示来自Twitter的最新报道。 当我点击趋势列表中的一个项目时,我转换到一个新的表格视图控制器,该控制器显示关于该趋势的最近的推文。 在故事部分的根控制器中,我可以在包含图像,链接等的不同视图控制器中显示更多信息。 问题是,当我selectstory部分中的任何内容时,我被推送到为趋势部分设置的表视图控制器。 我已经命名了每个segue,并为我想要转换的两个视图定制类,并且正在执行此操作以检查哪个segue被调用: -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([[segue identifier] isEqualToString:@"viewTrendsSearch"]) { //get the controller that we are going to segue to SearchTrendResultsViewController *strvc = [segue destinationViewController]; //get the path of the row that we want from the table view NSIndexPath *path = [self.tableView indexPathForSelectedRow]; //here we get the trend object from […]

UIScrollviewanimation取决于内容偏移量

我正在使用一个水平的UIScrollView,并且我想要一个背景颜色转换取决于内容偏移量的x值。 例如: UIScrollView的宽度是640px。 当内容偏移量等于0px时,背景色必须是红色的。 当内容偏移量为320像素时,背景必须是黄色的。 但最重要的部分是,当UIScrollview在0px和320px之间时,背景颜色必须在红色和黄色之间。 提示:当您从search向左滑动时,iOS的Twitter应用程序具有相同的animation。 导航上的标签稍微消失。

dynamic更改TableView单元格高度

Swift / Objective C – 简单的方法来dynamic改变TableView单元格的高度 在我的表格视图细胞突破第一行和第三行,每个标签将dynamic

如何将UIBezierPath带到MKAnnotation对象的后面?

在我的应用程序,用户在地图上绘制一个形状,并使用UIBeizerPath我正在绘制该path。 然后根据path的坐标,我显示只在该区域的结果。 一切都很好,除了现在注释掉落在地图视图上时,引脚看起来像是在path的后面,这意味着path看起来在前面。 我正在使用此代码来显示注释和path: -(void)clearAnnotationAndPath:(id)sender { [_mapView removeAnnotations:_mapView.annotations]; path = [UIBezierPath bezierPath]; [shapeLayer removeFromSuperlayer]; } – (void)handleGesture:(UIPanGestureRecognizer *)gesture { CGPoint location = [gesture locationInView:_pathOverlay]; if (gesture.state == UIGestureRecognizerStateBegan) { shapeLayer = [[CAShapeLayer alloc] init]; shapeLayer.fillColor = [[UIColor clearColor] CGColor]; shapeLayer.strokeColor = [[UIColor greenColor] CGColor]; shapeLayer.lineWidth = 5.0; //[_mapView.layer addSublayer:shapeLayer]; [pathOverlay.layer addSublayer:shapeLayer]; path = [UIBezierPath bezierPath]; […]

以编程方式在可用UIWebView中显示键盘

我的UIWebView加载一个contenteditable html内容。 我想让UIWebView得到专注,并在UIWebView中显示键盘。 我使用[self.webview becomeFirstResponder] ,但它不起作用。 有什么方法可以解决吗? 谢谢。

如何获得键盘大小调整UITextView和如何使用UIKeyboardFrameEndUserInfoKey与日本键盘?

如何获得一个键盘大小调整UITextView和如何使用UIKeyboardFrameEndUserInfoKey与日本键盘? 下面的代码来调整UITextView在标准键盘上工作良好。 但是不适用于日语。 如何解决它? – (void)keyboardWillShow:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:YES]; } – (void)keyboardWillHide:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:NO]; } – (void) moveTextViewForKeyboard:(NSNotification*)aNotification up: (BOOL) up { NSDictionary* userInfo = [aNotification userInfo]; // Get animation info from userInfo NSTimeInterval animationDuration; UIViewAnimationCurve animationCurve; CGRect keyboardEndFrame; [[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve]; [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration]; [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardEndFrame]; // Animate […]