类似QQ导航底部显示提示弹窗,能自动消失

类似QQ无网络时候从导航缓慢弹出提示弹窗的封装

//缓慢进入界面
这里写图片描述

//显示到导航底部
这里写图片描述

//渐渐淡出界面
这里写图片描述

//TipView.h

#import <UIKit/UIKit.h>

@interface TipView : UIView
@property (nonatomic,strong) UILabel *tipLab;
@end

//TipView.m”

#import "TipView.h"

@implementation TipView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame]) {
        self.backgroundColor = [UIColor grayColor];
        [self createSubViews];
        CATransition *animation = [CATransition animation];
        animation.duration = 0.5f;
        animation.timingFunction = UIViewAnimationCurveEaseInOut;
        animation.fillMode = kCAFillModeForwards;
        animation.type = kCATransitionMoveIn;
        animation.subtype = kCATransitionFromBottom;
        [self.layer addAnimation:animation forKey:@"animation"];
    }
    return self;
}

- (void)createSubViews
{
    _tipLab= [[UILabel alloc] init];
    _tipLab.text = @"提示的lable";
    _tipLab.frame = CGRectMake(15, 0, self.width, self.height);
    _tipLab.font = [UIFont systemFontOfSize:13];
    [self addSubview:_tipLab];
}

//view的调用

    TipView *tipView = [[TipView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, 40)];
    UIWindow * window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:tipView];

    [UIView animateWithDuration:5 animations:^{
        tipView.alpha = 0;
    } completion:^(BOOL finished) {
        [tipView removeFromSuperview];
    }];
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值