ATPopup 0.1.0

ATPopup 0.1.0

Maintained by ablettx.



 
Depends on:
ATAlertView-OC>= 0
ATSheetView>= 0
ATPickerView>= 0
ATToastView>= 0
ATLoadView>= 0
 

ATPopup 0.1.0

ATPopup

CI Status Version License Platform

Example

#import <ATPopup/ATPopup.h>

一、ATAlertView

  • Default
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();
  • Confirm
ATAlertView.build.withTitle(title).withDetail(@"Confirm Dialog").showInWindow();
  • Confirm / Without Title
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();
  • Link
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();
  • Input
ATPopupInputCompletionBlock didEndInputBlock = ^ (NSString *_Nonnull text) {
NSLog(@"didEndInput, text:%@", text);
};
ATAlertView.build.withTitle(title).withDetail(@"Input Dialog").\
withInputPlaceholder(@"Your placeholder").withDidEndInput(didEndInputBlock).showInWindow();

二、ATSheetView

  • Default
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

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

四、ATToastView

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

五、ATLoadView

  • Light
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];
});
  • Dark
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 image
//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];
});

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ATPopup is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ATPopup'

Author

ablettchen, [email protected]

License

ATPopup is available under the MIT license. See the LICENSE file for more info.