1. Создайте свой UIProgressView в вашем .h вместе с BOOL и NSTimer и вызовите функцию updateProgress
2. Синтезируйте в свой файл .m
3.В вашем «viewDidLoad» установите начальное значение BOOL на NO и создайте таймер
Ваш файл .h должен включать
UIProgressView * progressView;
BOOL emailSent;
NSTimer * timer;
-(void)updateProgress;
@property(nonatomic, retain)UIProgressView * progressView;
@property(nonatomic, assign)BOOL emailSent;
@property(nonatomic, retain)NSTimer * timer;
Ваш файл .mдолжен включать
@synthesize progressView, emailSent,timer;
//viewdidload
//set initial value to no
emailSent = NO;
//since we cant interact with UIElements on anything but the Main thread we use a timer
//because you are probably sending the email in a seperate thread
timer= [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(updateProgress) userInfo:nil repeats:YES];
//create this function
-(void)updateProgress{
//wait for email to be done
if (emailSent == NO) {
// you'll have to tweak this area to get the correct data "progress"
float fullValue = .0032;
int progressInt = (app.parsedCount * z);
//progressInt is the representation of how much data has been completed.
progressView.progress = progressInt;
}
else {
//email is done
emailSent = YES;
//kill the timer so it doesnt continue to run
[timer invalidate];
//email sent so you can remove your progress view
[self.view removeSubView:progressView];
}
}
Счастливое кодирование!