¡¡¡¡Èý£¬½áºÏһЩ½ø¶ÈÏÔʾµÄµÚÈý·½¿ò¼ÜʹÓÃ
¡¡¡¡È¥code4appÉÏÃæËæ±ãÏÂÔØÒ»¸öÏÔʾÏÂÔؽø¶ÈµÄµÚÈý·½¿ò¼Ü£¬ÕâÀïÒÔDACircularProgressViewΪÀý×Ó¡£
¡¡¡¡µ¼Èë¸Ã¿ò¼Ü±ØÒªµÄÎļþºó£¬¼òµ¥Ê¹ÓÃÈçÏ¡£
¡¡¡¡´úÂëʾÀý£º
1 #import "YYViewController.h" 2 #import "ASIHTTPRequest.h" 3 #import "DACircularProgressView.h" 4 5 @interface YYViewController ()<ASIProgressDelegate> 6 7 @property (weak, nonatomic) IBOutlet DACircularProgressView *circularView; 8 @property (weak, nonatomic) IBOutlet UIProgressView *progress; 9 @end 10 11 @implementation YYViewController 12 13 - (void)viewDidLoad 14 { 15 [super viewDidLoad]; 16 17 //ÉèÖûù±¾µÄһЩÊôÐÔ 18 self.circularView.trackTintColor=[UIColor lightGrayColor]; 19 self.circularView.progressTintColor=[UIColor yellowColor]; 20 } 21 22 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 23 { 24 //ÏÂÔØ·þÎñÆ÷ÉϵÄÎļþ 25 [self download]; 26 } 27 28 #pragma mark-ÏÂÔØÎļþ 29 -(void)download 30 { 31 //1.´´½¨ÇëÇó¶ÔÏó 32 NSURL *url=[NSURL URLWithString:@"http://127.0.0.1:8080/MJServer/resources/video.zip"]; 33 ASIHTTPRequest *request=[ASIHTTPRequest requestWithURL:url]; 34 35 //2.ÉèÖÃÏÂÔØÎļþ±£´æµÄ·¾¶ 36 NSString *cachepath=[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject]; 37 NSString *filename=[cachepath stringByAppendingPathComponent:@"video.zip"]; 38 request.downloadDestinationPath=filename; 39 NSLog(@"%@",filename); 40 41 //3.ÉèÖÃÏÂÔؽø¶ÈµÄ´úÀí 42 request.downloadProgressDelegate=self.circularView; 43 44 //4.·¢ËÍÍøÂçÇëÇó£¨Òì²½£© 45 [request startAsynchronous]; 46 47 //5.ÉèÖÃÖ§³Ö¶ÏµãÏÂÔØ 48 request.allowResumeForFileDownloads=YES; 49 50 //5.ÏÂÔØÍê±Ïºó֪ͨ 51 [request setCompletionBlock:^{ 52 NSLog(@"ÎļþÒѾÏÂÔØÍê±Ï"); 53 }]; 54 } 55 56 #pragma mark-¼àÌýÏÂÔؽø¶ÈµÄ´úÀí·½·¨ 57 @end |
¡¡¡¡ÏÔʾЧ¹û£º
¡¡¡¡ÌرðÌáʾ£º