小编Or *_*Ron的帖子

使用CAReplicatorLayer

我一直在尝试使用CAReplicatorlayer,CATextLayer和非常基本的动画创建一个很酷的文本效果.我试图让字母看起来像是从屏幕顶部下垂,然后是凉爽的复制器,这些复制器将变得越来越不可见.我设法做到了这个效果,但并不完全.

到目前为止,这就是我所拥有的:

CATextLayer *messageLayer = [CATextLayer layer];

[messageLayer setForegroundColor:[[UIColor blackColor] CGColor]];
[messageLayer setContentsScale:[[UIScreen mainScreen] scale]];
[messageLayer setFrame:CGRectMake(0, 0, 40, 40)];
[messageLayer setString:@"A"];


CAReplicatorLayer *replicatorX = [CAReplicatorLayer layer];

//Set the replicator's attributes
replicatorX.frame = CGRectMake(0, 0, 40, 40);
replicatorX.anchorPoint = CGPointMake(0,0);
replicatorX.position = CGPointMake(0, 0);
replicatorX.instanceCount = 9;
replicatorX.instanceDelay = 0.15;
replicatorX.instanceAlphaOffset = -0.1;

replicatorX.zPosition = 200;
replicatorX.anchorPointZ = -160;

[replicatorX addSublayer:messageLayer];

[self.view.layer addSublayer:replicatorX];


messageLayer.position = CGPointMake(40, 400);
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.y"];
animation.fromValue = [NSNumber numberWithInt:0];;
animation.toValue = [NSNumber numberWithInt:400]; …
Run Code Online (Sandbox Code Playgroud)

iphone animation core-animation ios careplicatorlayer

9
推荐指数
1
解决办法
2749
查看次数

操作系统正在杀死线程

我正在编写一个从影片剪辑中提取帧的应用程序.我设计它,以便提取将在一个单独的线程上完成,以防止应用程序冻结.提取过程本身占用了大量资源,但在模拟器中使用时效果很好.但是,在为iPad构建时存在问题.当我执行另一个动作(我告诉我的AV播放器在我提取帧时播放)时,线程意外停止工作,我相信它正在被杀死.

我认为这是因为我使用了大量资源,但并不完全确定.

以下是我的问题:1.如何判断我的线程是否停止?2.如果它真的来自过度处理我该怎么办?我真的需要这个行动来实施.

下面是一些使用的代码:创建线程:

[NSThread detachNewThreadSelector:@selector(startReading) toTarget:self withObject:nil];

我会发布你需要的任何信息,非常感谢!

更新 我现在正在使用GCD,它为我填充线程.然而,操作系统仍然杀死线程.

我确切知道它何时发生.当我告诉我的[AVplayer play]; 它杀了线程.

这个问题只发生在实际的iPad而不是模拟器上

iphone multithreading ipad ios

6
推荐指数
1
解决办法
714
查看次数

使用 Rails 进行移动 API 身份验证

我正在为一个APP构建一个移动API服务器。我的服务器需要支持用户和身份验证。在过去的两天里,我一直在寻找完成此类任务的良好宝石/最佳实践,但我未能找到。

我已经看到了围绕身份验证令牌的设计或自我实现的调整,但尚未发现针对如此琐碎任务的完整解决方案。

http://lucatironi.github.io/tutorial/2012/10/15/ruby_rails_android_app_authentication_devise_tutorial_part_one/

https://github.com/plataformatec/devise/issues/2739

ruby api mobile ruby-on-rails

5
推荐指数
1
解决办法
2500
查看次数

UITableView编辑缩进

我正在我的应用程序中使用我创建的自定义单元格构建一个非常简单的UITable.目标语言是希伯来语.这就是为什么我的所有表格都从右到左.一切正常,直到我将表格更改为编辑模式.我成功取消了删除和红色配件按钮,因为在反对的方向,但细胞得到这个小的缩进到右边,我的细胞的一部分没有显示.

我试过返回NO; 到功能

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath (NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

有什么建议 ?提前致谢

iphone uitableview

4
推荐指数
1
解决办法
4054
查看次数

使用Core动画为StrokeColor设置动画

我正在尝试为CAShapeLayar的strokeColor属性设置动画.我查看了文档,并声明它是一个可动画的属性.该代码用于动画postion.y但不是strokeColor.我很乐意得到任何帮助或建议

我用过的代码:

lyr.fillColor = [[UIColor clearColor] CGColor];
lyr.lineWidth = 3.8;
lyr.strokeColor = [[UIColor yellowColor] CGColor];
lyr.position = CGPointMake(160, 431);
lyr.anchorPoint = CGPointMake(.5f, .5f);
[self.view.layer addSublayer:lyr];

CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"strokeColor"];
basicAnimation.fromValue = [lyr valueForKey:@"strokeColor"];



basicAnimation.toValue =[NSValue valueWithPointer:[[UIColor clearColor] CGColor]];


basicAnimation.duration = 2;
basicAnimation.repeatCount = 10;
basicAnimation.autoreverses = YES;
[lyr addAnimation:basicAnimation forKey:@"strokeColor"];
Run Code Online (Sandbox Code Playgroud)

在此先感谢,或者.

core-animation core-graphics ios

3
推荐指数
1
解决办法
2707
查看次数