特性
- 一个自定制的 UIButton 类
需求
- iOS 7.0 或更高版本
- tvOS 9.0 或更高版本
- watchOS 2.0 或更高版本
- OS X 10.8 或更高版本
- Xcode 8.0 或更高版本
入门
- 阅读这个 Readme 文档
- 阅读 如何使用部分
- 阅读 CocoaDocs 上的 文档
- 通过从 Github 下载项目或通过 CocoaPods 尝试使用
pod try DPWidgetSum
来尝试示例 - 查看 安装步骤
使用该软件的人
- 找出 使用 DPWidgetSum 的人 并将你的应用程序添加到列表中。
通讯
- 如果您需要帮助,请访问 Stack Overflow。 (标签 'DPWidgetSum')
- 如果您想提出一个一般性问题,请访问 Stack Overflow。
- 如果您发现了一个错误,请提交一个问题。
- 如果您有一个功能请求,请提交一个问题。
- 如果您想做出贡献,请提交一个拉取请求。
使用方法
Objective-C:
#import "ReactiveObjC.h"
#import "DPWidgetSum.h"
#import "DPDefaultView.h"
#import "DPMessageAlertView.h"
#import "DPTimeAlertPickerView.h"
...
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *msgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
msgBtn.frame = CGRectMake(0, DP_StatusbarHeight+DP_FrameHeight(10), self.view.dp_width, 40);
msgBtn.backgroundColor = [UIColor orangeColor];
[msgBtn setTitle:@"消息弹框-DPMessageAlert" forState:UIControlStateNormal];
dp_arc_block(self);
[[msgBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
[ZCWAlertView showDPMessageAlertViewForTitle:@"警告" content:@"网络请求失败!" buttonTitles:@[@"取消", @"重新请求"] buttonBlock:nil];
}];
[self.view addSubview:msgBtn];
UIButton *defaultBtn = [UIButton buttonWithType:UIButtonTypeCustom];
defaultBtn.frame = CGRectMake(0, msgBtn.dp_yMax+DP_FrameHeight(10), self.view.dp_width, 40);
defaultBtn.backgroundColor = [UIColor purpleColor];
[defaultBtn setTitle:@"默认显示框-DPDefaultView" forState:UIControlStateNormal];
[[defaultBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
[DPDefaultView showDefaulTSuperView:weak_self.view topImage:nil title:nil btnTitle:nil btnBlock:^(DPDefaultView *aObject, UIButton *aButton) {
[aObject hiddenDefaulTSuperView];
}];
}];
[self.view addSubview:defaultBtn];
dateLab = [[UILabel alloc] init];
dateLab.userInteractionEnabled = YES;
dateLab.frame = CGRectMake(0, defaultBtn.dp_yMax+DP_FrameHeight(10), self.view.dp_width, DP_FrameHeight(40));
dateLab.backgroundColor = [UIColor greenColor];
dateLab.text = @"选择时间:";
[self.view addSubview:dateLab];
UITapGestureRecognizer *dateLabelTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dateLabelTapAction:)];
[dateLab addGestureRecognizer:dateLabelTap];
}
- (void)dateLabelTapAction:(UITapGestureRecognizer *)tap {
DPTimeAlertPickerView *datePickerView = [DPTimeAlertPickerView alertViewForParent:self.view uuid:0 alertViewStyle:DPTimeViewStyleOne level:1 AlertBlock:^(DPTimeAlertPickerView *aObject) {
NSString *dateStr = [NSDate dp_getStrForDateOrStr:aObject.selectDate formatter:@"yyyy-MM-dd" isIntercept:NO];
if (dateStr.length) {
self->dateLab.text = [@"选择时间: " stringByAppendingString:dp_notEmptyStr(dateStr)];
}
}];
NSDate *maxDate = [NSDate date];
NSDate *minDate = [NSDate dp_getPriousorLaterDateFromDate:maxDate withMonth:-3];
datePickerView.minDate = minDate;
datePickerView.maxDate = maxDate;
[datePickerView showTypeAlertViewForIsShow:YES];
}
...
安装
在您的项目中使用 DPWidgetSum 有三种方法
- 使用 CocoaPods
- 使用 Carthage
- 将项目克隆到您的仓库中
CocoaPods 安装
CocoaPods 是 Objective-C 的依赖管理器,它可以自动化并简化在项目中使用第三方库的过程。有关详细信息,请参阅入门指南。
Podfile
platform :ios, '7.0'
pod 'DPWidgetSum', '~> 1.0.5'
如果您使用 Swift,请确保添加 use_frameworks!
并将您的目标设置为 iOS 8+
platform :ios, '8.0'
use_frameworks!
构建项目
在此点,你应该可以无错误地构建工作区。如果你遇到问题,请在“问题”部分发布,社区可以帮助你解决它。
合作者
许可证
所有源代码均许可在MIT许可证下。