我嘗試將動畫圖像設置爲UILabel背景。我的標籤從點(x = 0 y260到x = 480 y = 260)移動,我想在動畫過程中添加UIImage。因此,對於我嘗試這樣如何將動畫圖像設置爲UILabel背景?
UIImageView *myimg=[[UIImageView alloc]init];
myimg.animationImages =[NSArray arrayWithObjects:
[UIImage imageNamed:@"1ANI.png"],
[UIImage imageNamed:@"2ANI.png"],
[UIImage imageNamed:@"3ANI.png"],nil];
myimg.animationDuration = 1.5;
myimg.animationRepeatCount = 0;
[myimg startAnimating];
[lbl1 addSubview:myimg];
[myimg release];
我設置的UILabel背景與單個的UIImage喜歡這個
UIImage *image=[UIImage imageNamed:@"1ANI.png"];
lbl2.backgroundColor = [UIColor colorWithPatternImage:image];
單幅圖像代碼的工作,但是當我嘗試用動畫圖像來實現它(如上我代碼顯示),那麼它不是作品能有人指導我如何設置動畫圖像作爲一個UILabel Background.Thanx
你被困在一個帶有清晰背景的標籤後面。如果您擔心想讓動畫隨標籤一起移動,請將它們放在另一個UIView中,然後移動它。 – 2012-10-17 19:01:15