ATPopup 0.1.0

ATPopup 0.1.0

ablettx维护。



 
依赖
ATAlertView-OC>= 0
ATSheetView>= 0
ATPickerView>= 0
ATToastView>= 0
ATLoadView>= 0
 

ATPopup 0.1.0

ATPopup

CI Status Version License Platform

示例

#import <ATPopup/ATPopup.h>

一、ATAlertView

  • 默认
NSString *detail = @"neach button take one row if there are more than 2 items";
NSArray *actions = @[ATPopupActionMake(@"Done", ATPopupActionStyleNormal, block),
ATPopupActionMake(@"Save", ATPopupActionStyleHighlighted, block),
ATPopupActionMake(@"Cancel", ATPopupActionStyleNormal, block)];
ATAlertView.build.withTitle(title).withDetail(detail).withActions(actions).showInWindow();
  • 确认
ATAlertView.build.withTitle(title).withDetail(@"Confirm Dialog").showInWindow();
  • 确认 / 无标题
NSString *detail = @"您的班级信息数据已更新完成,请重新刷新列表查看最新数据.";
NSArray *actions = @[ATPopupActionMake(@"知道了", ATPopupActionStyleHighlighted, block)];
ATPopupCompletionBlock didHideBlock = ^ (__kindof ATPopupView * _Nonnull popupView, BOOL finished) {
if (finished) {NSLog(@"didDisApper");}
};
ATAlertView.build.withDetail(detail).withActions(actions).withDidHide(didHideBlock).showInWindow();
  • 链接
NSString *detail = @"尊敬的用户,为给您提供更好的服务,本应用会使用到一些您的个人信息。不过请放心,我们非常重视您的个人信息和隐私保护,您的信息将仅用于为您提供服务或改善服务体验。请您在使用本应用之前仔细阅读《用户隐私政策》,如同意此政策,请点击“同意”并开始使用我们的产品和服务。";
NSURL *url = [NSURL URLWithString:@"https://github.com/ablettchen/ATPopupView"];
NSArray *links = @[ATPopupLinkMake(@"《用户隐私政策》", url, ^(ATPopupLink * _Nonnull link) {
NSLog(@"%@", link.url);
})];
NSArray *actions = @[ATPopupActionMake(@"退出", ATPopupActionStyleNormal, block),
ATPopupActionMake(@"同意", ATPopupActionStyleHighlighted, block)];
ATAlertView.build.withTitle(@"温馨提示").withDetail(detail).withActions(actions).withLinks(links).showInWindow();
  • 输入
ATPopupInputCompletionBlock didEndInputBlock = ^ (NSString *_Nonnull text) {
NSLog(@"didEndInput, text:%@", text);
};
ATAlertView.build.withTitle(title).withDetail(@"Input Dialog").\
withInputPlaceholder(@"Your placeholder").withDidEndInput(didEndInputBlock).showInWindow();

二、ATSheetView

  • 默认
NSArray *actions = @[ATPopupActionMake(@"Normal", ATPopupActionStyleNormal, block),
ATPopupActionMake(@"Highlighted", ATPopupActionStyleHighlighted, block),
ATPopupActionMake(@"Disabled", ATPopupActionStyleDisabled, block)];
ATSheetView *view = \
ATSheetView.build.withTitle(title).withActions(actions);
view.showInWindow();

三、ATPickerView

  • 默认
NSArray *items = @[@"语法课", @"自然拼读", @"阅读练习"];
ATPickerView *view = \
ATPickerView.build.withTitle(title).withItems(items).showInWindow();
view.confirmBlock = ^(NSInteger index) {
NSLog(@"selected:%@", items[index]);
};

四、ATToastView

  • 默认
ATToastView.build.withDetail(@"This description is used to generate tags and improve search results.").showInWindow();
  • 标题,详情
ATToastView.build.withTitle(@"连续学习达10分钟").withDetail(@"+15 贝乐币").showIn(self.view);

五、ATLoadView

  • 浅色
ATLoadView *view = ATLoadView.build.showIn(self.view); // default style is Light
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[view hide];
});
  • 暗色
ATLoadView *view = ATLoadView.build.withStyle(ATLoadStyleDark).showIn(self.view);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[view hide];
});
  • Gif图像
//ATLoadView *view = ATLoadView.build.withStyle(ATLoadStyleGifImage).showIn(self.view); // default gif image
ATLoadView *view = ATLoadView.build.withGifImage([YYImage imageNamed:@"popup_load_balls.gif"]).showIn(self.view);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[view hide];
});

要运行示例项目,请克隆仓库,并首先从示例目录运行pod install

需求

安装

ATPopup可以通过CocoaPods获得。要安装它,只需将以下行添加到您的Podfile中

pod 'ATPopup'

作者

ablettchen, [email protected]

许可协议

ATPopup 在 MIT 许可协议下可用。更多信息请参阅 LICENSE 文件。