顯示activity 指示器的代碼:
UIActivityIndicatorView *av = [[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];
av.frame=CGRectMake(0.5*winSize.width-winSize.width/4, 0.80*winSize.height , winSize.width/2, winSize.width/8);
[av setBackgroundColor:[UIColor colorWithRed:0.23 green:0.23 blue:0.23 alpha:0.75]];
av.layer.cornerRadius=4;
av.tag = 31000;
[[[CCDirector sharedDirector]view]addSubview:av];
[av startAnimating];
刪除:
UIActivityIndicatorView *tmpimg = (UIActivityIndicatorView *)[[[CCDirector sharedDirector]view] viewWithTag:31000];
if(tmpimg)
[((UIView *)tmpimg) removeFromSuperview];
預期實現的是刪除指示器本身。然後留下視圖(av.frame) 的矩形框。
但是全刪除了,不知道怎麼實現我想要的功能?
設置t
av.hidesWhenStopped = YES;
可以在indicator停止之後隱藏它。不需要刪除