Latest 1.1.0
Homepage https://github.com/568071718/DSHPopupContainer
License MIT
Platforms ios 8.0, requires ARC
Authors

DSHPopupContainer

iOS 客户端弹层容器  
主要是为了将弹层的自定义样式和动画效果与容器分离出来  
实际开发过程中可以专心考虑弹层的自定义样式和动画效果,需要弹出的时候使用这个工具用来进行弹出操作

使用

  • 创建一个自定义弹层,实现 DSHCustomPopupView 协议
    
    @interface CustomView : UIView <DSHCustomPopupView>
    @end

@implementation CustomView

// 自定义样式

  • (id)init {

    }

// 动画效果

  • (void)willPopupContainer:(DSHPopupContainer )container; {
    CGRect frame = self.frame;
    frame.size = CGSizeMake(288, 333);
    frame.origin.x = (container.frame.size.width – frame.size.width)
    .5;
    frame.origin.y = (container.frame.size.height – frame.size.height) * .5;
    self.frame = frame;
    }
  • (void)didPopupContainer:(DSHPopupContainer *)container duration:(NSTimeInterval)duration; {
    self.transform = CGAffineTransformMakeScale(1.1, 1.1);
    [UIView animateWithDuration:duration animations:^{
    self.transform = CGAffineTransformMakeScale(1.f, 1.f);
    }];
    }
  • (void)willDismissContainer:(DSHPopupContainer *)container duration:(NSTimeInterval)duration; {
    CGRect frame = self.frame;
    frame.origin.y = container.frame.size.height;
    [UIView animateWithDuration:duration animations:^{
    self.alpha = 0.f;
    }];
    }

@end

* 在需要弹出的位置创建弹层容器
```objective-c
CustomView *customView = [[CustomView alloc] init];
DSHPopupContainer *container = [[DSHPopupContainer alloc] initWithCustomPopupView:customView];
container.maskColor = [[UIColor blackColor] colorWithAlphaComponent:.5];
[container show];

Demo 效果图

image

Latest podspec

{
    "name": "DSHPopupContainer",
    "version": "1.1.0",
    "summary": "iOSu5f39u5c42u5bb9u5668",
    "description": "u7528u6765u81eau5b9au4e49u5f39u5c42u52a8u753buff0cu7ba1u7406u5f39u5c42u7684u5c0fu5de5u5177u3002",
    "homepage": "https://github.com/568071718/DSHPopupContainer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "lu": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/568071718/DSHPopupContainer.git",
        "tag": "1.1.0"
    },
    "requires_arc": true,
    "subspecs": [
        {
            "name": "Base",
            "source_files": "Classes"
        },
        {
            "name": "AlertView",
            "dependencies": {
                "DSHPopupContainer/Base": []
            },
            "source_files": "AlertView"
        }
    ]
}

Pin It on Pinterest

Share This