实现手机锁屏时"滑动来解锁"的效果

首先用cocopods导入框架:

实现代码如下:

在需要使用的地方导入头文件:

#import "FBShimmeringView.h"
@interface ViewController ()

@property (nonatomic, strong) UIImageView *imaView;
@property (nonatomic, strong) FBShimmeringView *fbView;
@property (nonatomic, strong) UILabel *labTitle;
@property (nonatomic, strong) FBShimmeringView *FBLabel;

@end
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    self.fbView = [[FBShimmeringView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
    //设置闪烁方向
    self.fbView.shimmeringDirection = FBShimmerDirectionRight;
    //设置闪烁
    self.fbView.shimmering = YES;
    //设置闪烁间隔
    self.fbView.shimmeringPauseDuration = 2.0;
    //设置闪烁时的透明度
    self.fbView.shimmeringAnimationOpacity = 0.5;
    //设置闪烁前的透明度
//    self.fbView.shimmeringOpacity = 0.5;
    //设置闪烁速度
    self.fbView.shimmeringSpeed = 200;
    //设置闪烁线的长度
//    self.fbView.shimmeringHighlightLength = 0.33;
    //设置闪烁线的宽度
    self.fbView.shimmeringHighlightWidth = 0.33;
    //设置开始闪烁的时间间隔
//    self.fbView.shimmeringBeginFadeDuration = 0.1;
//    //设置结束闪烁的时间间隔
//    self.fbView.shimmeringEndFadeDuration = 0.3;
    self.fbView.clipsToBounds = YES;
    self.fbView.layer.cornerRadius = 50;
    [self.view addSubview:_fbView];
    
    self.imaView = [[UIImageView alloc]initWithFrame:_fbView.bounds];
    self.imaView.layer.masksToBounds = YES;
    self.imaView.layer.cornerRadius = 50;
    self.imaView.image = [UIImage imageNamed:@"哈哈"];
    self.fbView.contentView = _imaView;
    
    
    self.FBLabel = [[FBShimmeringView alloc]initWithFrame:CGRectMake(50, 300, 300, 30)];
    self.FBLabel.shimmering = YES;
    self.FBLabel.shimmeringOpacity = 0.2;
    self.FBLabel.shimmeringBeginFadeDuration = 0.5;
    self.FBLabel.shimmeringSpeed = 200;
    self.FBLabel.shimmeringAnimationOpacity = 1.0;
    [self.view addSubview:_FBLabel];
    
    self.labTitle = [[UILabel alloc]initWithFrame:self.FBLabel.bounds];
    self.labTitle.text = @"世人都在防老王,却被老宋翻了强";
    self.labTitle.textColor = [UIColor cyanColor];
    self.labTitle.font = [UIFont systemFontOfSize:20 weight:2];
    _FBLabel.contentView = _labTitle;
    
}

 

这样就搞定了,可以写一下看看,效果不错的...

 

转载于:https://www.cnblogs.com/LzwBlog/p/5776881.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值