use*_*562 4 iphone objective-c uiprogressview uialertview ios
嗨,大家好我想在UIAlertView上显示UIProgressView,用于显示文件上传的处理,但我搜索过多,也找到了该链接但是sill无法做到这一点.我不明白这一点
如果有人知道最简单的方法,请告诉我.我会感恩的.
小智 6
我这样做有问题,最后得到了这个:
av = [[UIAlertView alloc] initWithTitle:@"Running" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
progressView.frame = CGRectMake(0, 0, 200, 15);
progressView.bounds = CGRectMake(0, 0, 200, 15);
progressView.backgroundColor = [UIColor blackColor];
[progressView setUserInteractionEnabled:NO];
[progressView setTrackTintColor:[UIColor blueColor]];
[progressView setProgressTintColor:[UIColor redColor]];
[av setValue:progressView forKey:@"accessoryView"];
[av show];
Run Code Online (Sandbox Code Playgroud)
试试这个代码......
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
UIProgressView *pv = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
pv.frame = CGRectMake(20, 20, 200, 15);
pv.progress = 0.5;
[av addSubview:pv];
[av show];
Run Code Online (Sandbox Code Playgroud)