我有一个转过来的圆圈,我怎么能给他贴上一些随身携带的标签呢? 我的观点是圆圈和标签应该在同一个天使上。
答案 0 :(得分:1)
使标签成为您用来呈现圆圈的UIView的子视图。
在IB中,只需将标签拖到您用于圆圈图像的UIView上,或者如果您不使用IB,只需将标签添加到圆圈中,如下所示:
[circleUIView addSubview:theUILabel];
答案 1 :(得分: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"];