
圖片發(fā)自簡書App
二話不說,先上代碼,下午我再娓娓道來實現(xiàn)方法吧
.h
//
// SecondViewController.h
// NotificationAnimationView
//
// Created by xiāo yáng on 2019/8/8.
// Copyright ? 2019 ccb. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController
@end
.m
//
// SecondViewController.m
// NotificationAnimationView
//
// Created by xiāo yáng on 2019/8/8.
// Copyright ? 2019 ccb. All rights reserved.
//
#import "SecondViewController.h"
#import "NotificationAnimationView.h"
@interface SecondViewController ()<NotificationAnimationViewDelegate>
@property (nonatomic , strong) NotificationAnimationView *notificationAnimationView;
@end
@implementation SecondViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor=[UIColor systemGreenColor];
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
if (!_notificationAnimationView) {
_notificationAnimationView = [[NotificationAnimationView alloc]initWithEffect:effect];
}
_notificationAnimationView.delegate=self;
[self.view addSubview:_notificationAnimationView];
// Do any additional setup after loading the view.
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
dispatch_async(dispatch_get_main_queue(), ^{
[self.notificationAnimationView ShowNoticeAnimationView:@"蘋果官方通知" NoticeContent:@"你好,你做的通知和我們的通知相似度接近100%,中國民生銀行,招商銀行,河北銀行,包商銀行,大家保險以及21世紀不動產送來賀電!" AnimationTime:4.0 FixedHeight:YES];
});
}
#pragma mark - delegate
-(void)StartNotificationAnimation
{
NSLog(@"+++++++++++++++++++++++");
}
-(void)EndNotificationAnimation
{
NSLog(@"-----------------------");
}
@end
詳情請走GitHub,記得先給我星星?,在看我的源代碼
https://github.com/xiaoyang-iOS/NotificationAnimationView.git