如何从 UIView 录制一段时间的视频,就像我们录制手机屏幕的一部分一样?
Glimpse 允许您从 UIViews 创建视频。更多文档在这里,但基本上它通过拍摄一系列 UIView 的屏幕截图,然后创建一个快速视频并将其保存到应用程序的文档文件夹中来记录动画和 Action 。
这是一个示例用法:
#import <Glimpse/Glimpse.h>
@implementation myViewController
- (void)viewDidAppear
{
[super viewDidAppear:animated];
// Create a new Glimpse object.
Glimpse *glimpse = [[Glimpse alloc] init];
// Start recording and tell Glimpse what to do when you are finished
[glimpse startRecordingView:self.view onCompletion:^(NSURL *fileOuputURL) {
NSLog(@"DONE WITH OUTPUT: %@", fileOuputURL.absoluteString);
}];
// Create a subview for this example
UIView *view = [[UIView alloc] initWithFrame:CGRectInset(self.view.bounds, 40.0f 40.0f)];
view.backgroundColor = [UIColor greenColor];
view.alpha = 0.0f;
[self.view addSubview:view];
// We are going to record the view fading in.
[UIView animateWithDuration:5.0 animations:^{
view.alpha = 1.0f;
} completion:^(BOOL finished) {
// Since our animation is complete, lets tell Glimpse to stop recording.
[glimpse stop];
}];
}
@end
关于ios - 渲染一个 UIView ,其中某些东西会被动画化并从中导出视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35422154/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://ogeek.cn/) | Powered by Discuz! X3.4 |