我不是很肯定,但我认为你有当您为标签设置坐标时,请将x,y等变量替换为参数1和2的值,并将其放入动画计时器,并将其更改为x和y的值。
类似的代码,它是图像可以为标签做到这一点也: -
// Build array of images, cycling through image names
for (int i = 0; i < IMAGE_COUNT; i++)
[imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"Frame_%d.jpg", i]]];
// Animated images - centered on screen
animatedImages = [[UIImageView alloc]
initWithFrame:CGRectMake(
(SCREEN_WIDTH/2) - (IMAGE_WIDTH/2),
(SCREEN_HEIGHT/2) - (IMAGE_HEIGHT/2) + STATUS_BAR_HEIGHT,
IMAGE_WIDTH, IMAGE_HEIGHT)];
animatedImages.animationImages = [NSArray arrayWithArray:imageArray];
// One cycle through all the images takes 1.5 seconds
animatedImages.animationDuration = 1.0;
// Repeat forever
animatedImages.animationRepeatCount = -1;
// Add subview and make window visible
[window addSubview:animatedImages];
[window makeKeyAndVisible];
// Start it up
animatedImages.startAnimating;
// Wait 5 seconds, then stop animation
[self performSelector:@selector(stopAnimation) withObject:nil afterDelay:1000];
我希望它可以帮助你.. :)
来源
2011-11-18 13:30:44
mAc
帐篷仍然是有史以来最好的HTML标签。我们应该更频繁地使用它! – JustSid
这是iPhone的问题,所以我该如何使用这个uilable。 –
可能重复的[如何将标签添加到标签](http://stackoverflow.com/questions/1118626/how-to-add-marquee-to-a-label) –