Commit abaae4a2 authored by Dominic Vedericho's avatar Dominic Vedericho
Browse files

Merge branch 'release/0.2.5'

parents c6360a36 f4165f6a
No preview for this file type
......@@ -27,8 +27,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (weak, nonatomic) id <TAPPopUpInfoViewControllerDelegate> delegate;
@property (strong, nonatomic) TAPPopUpInfoView *popUpInfoView;
@property (nonatomic) TAPPopUpInfoViewControllerType popUpInfoViewControllerType;
@property (strong, nonatomic) NSString *titleInformation;
@property (strong, nonatomic) NSString *detailInformation;
- (void)setPopUpInfoViewControllerType:(TAPPopUpInfoViewControllerType)popUpInfoViewControllerType withTitle:(NSString *)title detailInformation:(NSString *)detailInfo;
- (void)showPopupInfoView:(BOOL)isShow animated:(BOOL)animated completion:(void (^ __nullable)(void))completion;
@end
......
......@@ -18,40 +18,89 @@
@implementation TAPPopUpInfoViewController
#pragma mark - Lifecycle
//- (void)loadView {
// [super loadView];
//}
- (void)loadView {
[super loadView];
_popUpInfoView = [[TAPPopUpInfoView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.popUpInfoView.leftButton addTarget:self action:@selector(popUpInfoViewHandleDidTappedLeftButton) forControlEvents:UIControlEventTouchUpInside];
[self.popUpInfoView.rightButton addTarget:self action:@selector(popUpInfoViewHandleDidTappedRightButton) forControlEvents:UIControlEventTouchUpInside];
self.popUpInfoView.alpha = 0.0f;
[self.view addSubview:self.popUpInfoView];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
_popUpInfoView = [[TAPPopUpInfoView alloc] initWithFrame:[TAPBaseView frameWithoutNavigationBar]];
[self.view addSubview:self.popUpInfoView];
self.view.backgroundColor = [UIColor clearColor];
[self.popUpInfoView.leftButton addTarget:self action:@selector(popUpInfoViewHandleDidTappedLeftButton) forControlEvents:UIControlEventTouchUpInside];
[self.popUpInfoView.rightButton addTarget:self action:@selector(popUpInfoViewHandleDidTappedRightButton) forControlEvents:UIControlEventTouchUpInside];
if (self.popUpInfoViewControllerType == TAPPopUpInfoViewControllerTypeErrorMessage) {
[self.popUpInfoView setPopupInfoViewType:TAPPopupInfoViewTypeErrorMessage withTitle:self.titleInformation detailInformation:self.detailInformation];
[self.popUpInfoView isShowTwoOptionButton:NO];
}
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self showPopupInfoView:YES animated:YES completion:^{
}];
}
#pragma mark - Custom Method
- (void)popUpInfoViewHandleDidTappedLeftButton {
if ([self.delegate respondsToSelector:@selector(popUpInfoViewControllerDidTappedLeftButton)]) {
[self.delegate popUpInfoViewControllerDidTappedLeftButton];
}
[self showPopupInfoView:NO animated:YES completion:^{
[self dismissViewControllerAnimated:NO completion:^{
if ([self.delegate respondsToSelector:@selector(popUpInfoViewControllerDidTappedLeftButton)]) {
[self.delegate popUpInfoViewControllerDidTappedLeftButton];
}
}];
}];
}
- (void)popUpInfoViewHandleDidTappedRightButton {
if ([self.delegate respondsToSelector:@selector(popUpInfoViewControllerDidTappedSingleButtonOrRightButton)]) {
[self.delegate popUpInfoViewControllerDidTappedSingleButtonOrRightButton];
}
[self showPopupInfoView:NO animated:YES completion:^{
[self dismissViewControllerAnimated:NO completion:^{
if ([self.delegate respondsToSelector:@selector(popUpInfoViewControllerDidTappedSingleButtonOrRightButton)]) {
[self.delegate popUpInfoViewControllerDidTappedSingleButtonOrRightButton];
}
}];
}];
}
- (void)setPopUpInfoViewControllerType:(TAPPopUpInfoViewControllerType)popUpInfoViewControllerType withTitle:(NSString *)title detailInformation:(NSString *)detailInfo {
_popUpInfoViewControllerType = popUpInfoViewControllerType;
if (self.popUpInfoViewControllerType == TAPPopUpInfoViewControllerTypeErrorMessage) {
[self.popUpInfoView setPopupInfoViewType:TAPPopupInfoViewTypeErrorMessage withTitle:title detailInformation:detailInfo];
[self.popUpInfoView isShowTwoOptionButton:NO];
_titleInformation = title;
_detailInformation = detailInfo;
}
- (void)showPopupInfoView:(BOOL)isShow animated:(BOOL)animated completion:(void (^)(void))completion {
if (animated) {
if (isShow) {
[UIView animateWithDuration:0.2f animations:^{
self.popUpInfoView.alpha = 1.0f;
} completion:^(BOOL finished) {
completion();
}];
}
else {
[UIView animateWithDuration:0.2f animations:^{
self.popUpInfoView.alpha = 0.0f;
} completion:^(BOOL finished) {
completion();
}];
}
}
else {
if (isShow) {
self.popUpInfoView.alpha = 1.0f;
completion();
}
else {
self.popUpInfoView.alpha = 0.0f;
completion();
}
}
}
......
......@@ -81,7 +81,7 @@
self.rightButton.frame = CGRectMake(CGRectGetMinX(self.rightButton.frame), CGRectGetMaxY(self.detailLabel.frame) + 16.0f, CGRectGetWidth(self.rightButton.frame), CGRectGetHeight(self.rightButton.frame));
self.leftButton.frame = CGRectMake(CGRectGetMinX(self.leftButton.frame), CGRectGetMinY(self.rightButton.frame), CGRectGetWidth(self.leftButton.frame), CGRectGetHeight(self.leftButton.frame));
CGFloat popupInfoViewHeight = CGRectGetMaxY(self.rightButton.frame) + 16.0f;
self.popupWhiteView.frame = CGRectMake(CGRectGetMinX(self.popupWhiteView.frame), (CGRectGetHeight(self.frame) - popupInfoViewHeight) / 2.0f, CGRectGetWidth(self.popupWhiteView.frame), popupInfoViewHeight);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment