我在iOS应用程序中有一系列用户自定义图像,这些图像以简单的逐帧翻书风格进行动画制作.
我的问题是:有没有办法让用户将动画导出为GIF动画?理想情况下,我想让他们通过电子邮件,社交分享(T/FB)或(最糟糕的情况......)将动画gif保存到他们的文档文件夹中,以便通过iTunes进行检索.
我知道如何将.png保存到照片库,我找到了一种将动画录制为QT文件的方法(http://www.cimgf.com/2009/02/03/record-your-core-animation - 动画/),但我还没有找到一种方法来踢出一个普通的老动画GIF.我在Core Animation或其他地方遗漏了什么吗?是否有任何人可以推荐的方法,框架或资源?对不起,如果问题太笼统 - 努力找到一个起点.
我有两个水平滚动的UIScrollViews在一个ViewController中垂直堆叠在一起.每个UIScrollView占用屏幕的一半.我试图独立跟踪两个UIScrollViews的位置.
我已成功使用它来跟踪顶部UIScrollView的位置:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView1 {
int Position = (scrollView1.contentOffset.x);
if (Position == 0) {
NSLog(@"Play A");
}
else if (Position == 280) {
NSLog(@"Play B");
}
//etc.
}
Run Code Online (Sandbox Code Playgroud)
我想跟踪底部UIScrollView的位置.
当我尝试使用它时:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView2 {
int Position2 = (scrollView2.contentOffset.x);
if (Position2 == 0) {
NSLog(@"Play A2");
}
else if (Position == 280) {
NSLog(@"Play B2");
}
//etc.
}
Run Code Online (Sandbox Code Playgroud)
我收到一条错误,上面写着"重新定义FirstViewConroller scrollViewDidScroll".
因此,我决定坚持下去,我尝试了一个相当hackish的解决方案,并尝试使用它:
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView2
{
int Position2 = (scrollView2.contentOffset.x);
if (Position2 == 0) {
NSLog(@"Play A2");
}
else if (Position2 …Run Code Online (Sandbox Code Playgroud) 我使用一些简单的代码来播放音频文件:
NSString *pathToMusicFile1 = [[NSBundle mainBundle] pathForResource:@"song" ofType:@"mp3"];
mySong1 = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:pathToMusicFile1] error:NULL];
NSLog(@"Song1 Loaded");
mySong1.numberOfLoops = -1;
mySong1.volume = 1.0;
[mySong1 play];
Run Code Online (Sandbox Code Playgroud)
我导入了AVFoundation,我在头文件中声明了mySong1,然后在我的实现文件中合成它.在大多数情况下,此代码工作正常.我没有错误,音频在模拟器中播放效果很好.它在运行4.0的iPhone 3GS和运行3.1.3的原始iPhone上也能正常运行.问题是它不能在运行iOS 4.1的iPhone 4上播放.我试过清理项目以及重新启动手机.都没有帮助.我也试过一个.aiff文件而不是mp3,但也没有运气.
我错过了什么?是否有另一种播放我现在应该使用的声音的方法?任何帮助赞赏.无法弄清楚问题在这里.谢谢你的帮助.
xcode ×2
animated-gif ×1
cocoa ×1
cocoa-touch ×1
ios ×1
ios4 ×1
iphone-4 ×1
objective-c ×1
swift ×1
uiscrollview ×1