我有一个会翻的圈子,我怎么给他贴一些会跟着他翻的标签?我的观点是圆圈和标签应该在同一个天使上。
问问题
135 次
2 回答
1
使标签成为您用来呈现圆圈的 UIView 的子视图。在 IB 中,只需将标签拖到您用于圆形图像的 UIView 上,或者如果您不使用 IB,只需将标签添加到圆形,如下所示:
[circleUIView addSubview:theUILabel];
于 2012-07-29T14:30:03.707 回答
0
Download demo source code this url http://www.devedup.com/index.php/2010/03/03/iphone-animate-an-object-along-a-path/
Now changes into Canvas.m file's animateCicleAlongPath method.
Replace to image to label.
UILabel *label = [[UILabel alloc]init];
[label setText:@"test"];
[label setTextColor:[UIColor redColor]];
//Set the frame of the view - which is used to position it when we add it to our current UIView
label.frame = CGRectMake(1, 1, 20, 20);
label.backgroundColor = [UIColor clearColor];
[self addSubview:label];
[label.layer addAnimation:pathAnimation forKey:@"moveTheSquare"];
于 2012-07-30T13:40:34.423 回答