Skip to content

weirdyu/XLPopup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

XLPopup

Customizable popup for iOS.

XLPopup is now available.

Preview

img

Usage

Custom view from XLPopupView

Override init Method

CustomPopupView.m

+ (instancetype)showPopupViewWithShowType:(XLPopupShowType)showType maskType:(XLPopupMaskType)maskType
{
    CustomPopupView *popupView = [[CustomPopupView alloc] initWithSuperView:nil showType:showType maskType:maskType];
    [popupView show];
    return popupView;
}

#pragma mark - Override Method

- (instancetype)initWithSuperView:(UIView *)superView showType:(XLPopupShowType)showType maskType:(XLPopupMaskType)maskType
{
    self = [super initWithSuperView:superView showType:showType maskType:maskType];
    if (self) {
        self.delegate = self;
	//----------custom setup subviews----------
        BOOL isMaskLight;
        if (maskType == XLPopupMaskTypeNormal || maskType == XLPopupMaskTypeDarkBlur) {
            isMaskLight = NO;
        }else {
            isMaskLight = YES;
        }
        self.backgroundColor = isMaskLight? [UIColor grayColor]:[UIColor whiteColor];
        self.clipsToBounds = YES;
        self.layer.cornerRadius = 10;
        
        UILabel *label = [UILabel new];
        label.text = @"customView";
        label.textColor = isMaskLight? [UIColor whiteColor]:[UIColor grayColor];
        label.textAlignment = NSTextAlignmentCenter;
        [self addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self);
            make.width.equalTo(self);
        }];
       	//------------------------------------------
    }
    return self;
}

Implementation protocol

#pragma mark - XLPopupViewDelegate

- (void)popupViewLayoutFinalPostion
{
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.superview);
        make.height.equalTo(@(200));
        make.width.equalTo(self.superview).multipliedBy(0.8);
    }];
}

- (BOOL)popupViewDismissWhenMaskViewDidTap
{
    return YES;
}

TODO

Custom Animation Example

About

Customizable popup for iOS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published