我正在尝试更改摄像机视图Front和.Back它运行良好Pause/Record.如果Flip Camera View录制的视频没有翻转选项它工作正常.但如果我们曾经,那么进一步录制视频不保存导致AVAssetWriterStatusFailed- The operation could not be completed.任何人都可以帮我找到我出错的地方吗?以下是我的代码.
Run Code Online (Sandbox Code Playgroud)- (void)flipCamera{ NSArray * inputs = _session.inputs; for ( AVCaptureDeviceInput * INPUT in inputs ) { AVCaptureDevice * Device = INPUT.device ; if ( [ Device hasMediaType : AVMediaTypeVideo ] ) { AVCaptureDevicePosition position = Device . position ; AVCaptureDevice * newCamera = nil ; AVCaptureDeviceInput * newInput = nil ; if ( position == AVCaptureDevicePositionFront ) newCamera = …
我需要检测描述中给出的#TagsUILabel并更改文本颜色,[UIColor BlueColor];因为我无法将特定文本颜色更改UILabel为蓝色.现在我UILabel在自定义中使用它UITableViewCell.有没有办法解决这个问题,以区分#Tags和普通文本的文字颜色?任何人都可以帮我解决这个问题吗?
我试图找到Tapped String in UITextView.我试过了.UIDataDetectorTypeLink但它没有用.我也不确定是否有可能检测到String.我正在使用UITextView自定义UITableViewCell.从那我我试图检测轻拍的字符串.以下是我试过的示例代码.任何人都可以帮我找到我做错了什么,我怎么能解决这个问题?即使不可能,我该如何解决这个问题呢?
NSMutableArray *sampleArray = [[NSMutableArray alloc]init];
NSMutableString *mutableString = [[NSMutableString alloc]init];
NSMutableAttributedString * string;
sampleArray = [[postArray valueForKey:@"hash_tags"] objectAtIndex:indexPath.row];
for(NSString *sampleString in sampleArray){
if (mutableString.length == 0) {
[mutableString appendString:sampleString];
}else{
[mutableString appendString:[NSString stringWithFormat:@", %@",sampleString]];
}
string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",mutableString]];
// [string addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(0,[string length])];
}
NSDictionary *linkAttributes = @{NSForegroundColorAttributeName: [UIColor colorWithRed:5.0f/255.0f green:107.0f/255.0f blue:153.0f/255.0f alpha:1.0f], NSUnderlineColorAttributeName: [UIColor greenColor],NSUnderlineStyleAttributeName: @(NSUnderlinePatternSolid)};
[string addAttribute:NSLinkAttributeName
value:string
range:NSMakeRange(0, [string …Run Code Online (Sandbox Code Playgroud) 我正在尝试裁剪视频帧。我已经使用AVFoundation框架录制了视频。我需要将捕捉的图像和录制的视频裁剪为正方形。我已经完成了UIImage工作,现在我正在尝试裁剪视频。
Run Code Online (Sandbox Code Playgroud)- (UIImage *)squareImageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize { // Cropping UIImage is working fine. CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0,0, image.size.width, image.size.width)); UIImage *result = [UIImage imageWithCGImage:imageRef scale:image.scale orientation:image.imageOrientation]; CGImageRelease(imageRef); return result; }
我尝试裁剪视频,但结果是整个视频帧都没有裁剪,而是看起来很拉伸。
Run Code Online (Sandbox Code Playgroud)_writer = [AVAssetWriter assetWriterWithURL:url fileType:AVFileTypeQuickTimeMovie error:nil]; NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys: AVVideoCodecH264, AVVideoCodecKey, [NSNumber numberWithInt: 320], AVVideoWidthKey, [NSNumber numberWithInt: 320], AVVideoHeightKey, nil]; _videoInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:settings]; [_writer addInput:_videoInput];
有人可以帮助我解决视频播种问题吗?提前致谢。
objective-c avfoundation ios avassetwriter avvideocomposition
ios ×4
objective-c ×4
avfoundation ×2
uitableview ×2
hashtag ×1
nsstring ×1
uilabel ×1
uitextview ×1