iOS 下载按钮 DownloadButton
- 授权协议: Apache 2.0
- 开发语言: Objective-C
- 操作系统: iOS
- 软件首页: https://github.com/PavelKatunin/DownloadButton
软件介绍
DownloadButton 是可自定义的 App Store 风格的下载按钮。可自定义设计组件,用 IB 进行编辑。
使用示例:
#pragma mark - PKDownloadButtonDelegate
- (void)downloadButtonTapped:(PKDownloadButton *)downloadButton
currentState:(PKDownloadButtonState)state {
switch (state) {
case kPKDownloadButtonState_StartDownload:
self.downloadButton.state = kPKDownloadButtonState_Pending;
[self.pendingSimulator startDownload];
break;
case kPKDownloadButtonState_Pending:
[self.pendingSimulator cancelDownload];
self.downloadButton.state = kPKDownloadButtonState_StartDownload;
break;
case kPKDownloadButtonState_Downloading:
[self.downloaderSimulator cancelDownload];
self.downloadButton.state = kPKDownloadButtonState_StartDownload;
break;
case kPKDownloadButtonState_Downloaded:
self.downloadButton.state = kPKDownloadButtonState_StartDownload;
self.imageView.hidden = YES;
break;
default:
NSAssert(NO, @"unsupported state");
break;
}
}
#pragma mark - DownloaderSimulatorDelegate
- (void)simulator:(PKDownloaderSimulator *)simulator didUpdateProgress:(double)progress {
if (simulator == self.pendingSimulator) {
if (progress == 1.) {
self.downloadButton.state = kPKDownloadButtonState_Downloading;
[self.downloaderSimulator startDownload];
}
}
else if (simulator == self.downloaderSimulator) {
self.downloadButton.stopDownloadButton.progress = progress;
if (progress == 1) {
self.downloadButton.state = kPKDownloadButtonState_Downloaded;
self.imageView.hidden = NO;
}
}
}Effective C++
[美]Scott Meyers / 侯捷 / 电子工业出版社 / 2006-7 / 58.00元
《Effective C++:改善程序与设计的55个具体做法》(中文版)(第3版)一共组织55个准则,每一条准则描述一个编写出更好的C++的方式。每一个条款的背后都有具体范例支撑。第三版有一半以上的篇幅是崭新内容,包括讨论资源管理和模板(templates)运用的两个新章。为反映出现代设计考虑,对第二版论题做了广泛的修订,包括异常(exceptions)、设计模式(design patterns)......一起来看看 《Effective C++》 这本书的介绍吧!
