]半透明的UIView作进度提示,或者说是半透明遮盖。附源码

看到这里有过讨论: http://www.cocoachina.com/bbs/read.php?tid-3679.html

正好也需要一个这样的界面,就写了一下。
没有使用UIAlertView是因为我不知道如何用代码使其消失(除非release,但我还想重复利用呢),而且也不知道如何让alert的边框隐藏掉……

以下是代码,用完后记得release

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
+(UIView *)waitingView
{
     CGRect frame = CGRectMake(90, 190, 32, 32);
     UIActivityIndicatorView* progressInd = [[UIActivityIndicatorView alloc] initWithFrame:frame];
     [progressInd startAnimating];
     progressInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
     
     frame = CGRectMake(130, 193, 140, 30);
     UILabel *waitingLable = [[UILabel alloc] initWithFrame:frame];
     waitingLable.text = @ "Processing..." ;
     waitingLable.textColor = [UIColor whiteColor];
     waitingLable.font = [UIFont systemFontOfSize:20];;
     waitingLable.backgroundColor = [UIColor clearColor];
     
     frame = [[UIScreen mainScreen] applicationFrame];
     UIView *theView = [[UIView alloc] initWithFrame:frame];
     theView.backgroundColor = [UIColor blackColor];
     theView.alpha = 0.7;
     [theView addSubview:progressInd];
     [theView addSubview:waitingLable];
     
     [progressInd release];
     [waitingLable release];
     
     return theView;
}
[ 此帖被bobgreen在2009-07-02 18:14重新编辑 ]

图片:Picture 1.png 
]半透明的UIView作进度提示,或者说是半透明遮盖。附源码_第1张图片

你可能感兴趣的:(]半透明的UIView作进度提示,或者说是半透明遮盖。附源码)