首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SKPSMTPMessage和UIProgressView

SKPSMTPMessage和UIProgressView
EN

Stack Overflow用户
提问于 2011-06-08 03:58:24
回答 1查看 331关注 0票数 0

我在我的iPhone应用程序中使用此库(http://code.google.com/p/skpsmtpmessage/)发送电子邮件

如何在发送过程中实现UIProgressView?

谢谢你的帮助!

EN

回答 1

Stack Overflow用户

发布于 2011-06-08 04:56:06

  1. 1.在.h中创建UIProgressView,以及BOOL、NSTimer和一个名为updateProgress的函数

2.在.m文件中进行合成

3.在您的"viewDidLoad“中,将BOOL的初始值设置为NO,并创建一个计时器

您的.h文件应该包括

代码语言:javascript
复制
UIProgressView * progressView;
BOOL emailSent;
NSTimer * timer;

-(void)updateProgress;
@property(nonatomic, retain)UIProgressView * progressView;
@property(nonatomic, assign)BOOL emailSent;
@property(nonatomic, retain)NSTimer * timer;

您的.m文件应该包括

代码语言:javascript
复制
@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];
    }
}

祝你编码愉快!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6270896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档