iOS_带发光效果的Label




//
//  GlowLabel.h
//  帅哥句子
//
//  Created by beyond on 16/8/5.
//  Copyright © 2016年 beyond. All rights reserved.
//  发光的Label

#import <UIKit/UIKit.h>

@interface GlowLabel : UILabel
//定义颜色值全局变量和放大值全局变量
 @property(assign,nonatomic)float redValue;
 @property(assign,nonatomic)float greenValue;
 @property(assign,nonatomic)float blueValue;
 @property(assign,nonatomic)float size;

@end





//
//  GlowLabel.m
//  帅哥句子
//
//  Created by beyond on 16/8/5.
//  Copyright © 2016年 beyond. All rights reserved.
//

#import "GlowLabel.h"

@implementation GlowLabel

  @synthesize redValue;
  @synthesize greenValue;
  @synthesize blueValue;
  @synthesize size;

  -(id) initWithFrame: (CGRect)frame {
          if ((self = [super initWithFrame:frame])) {
                   //变量初始化
                  redValue = 1.0f;
                  greenValue = 1.0f;
                  blueValue = 1.0f;
        
              size=8.0f;//20.0f;
              }
          return self;
      }

  //重写UILable类的drawTextInRect方法
  -(void) drawTextInRect: (CGRect)rect {
          //定义阴影区域
          CGSize textShadowOffest = CGSizeMake(0, 0);
          //定义RGB颜色值
          CGFloat textColorValues[] = {redValue, greenValue, blueValue, 1.0};
    
          //获取绘制上下文
          CGContextRef ctx = UIGraphicsGetCurrentContext();
          //保存上下文状态
          CGContextSaveGState(ctx);
    
          //为上下文设置阴影
          CGContextSetShadow(ctx, textShadowOffest, size);
          //设置颜色类型
          CGColorSpaceRef textColorSpace = CGColorSpaceCreateDeviceRGB();
          //根据颜色类型和颜色值创建CGColorRef颜色
          CGColorRef textColor = CGColorCreate(textColorSpace, textColorValues);
          //为上下文阴影设置颜色阴影颜色阴影大小
          CGContextSetShadowWithColor(ctx, textShadowOffest, size, textColor);
    
          [super drawTextInRect:rect];
    
    
          //释放
          CGColorRelease(textColor);
          CGColorSpaceRelease(textColorSpace);
    
          //重启上下文
          CGContextRestoreGState(ctx);
      }


@end








  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
闪烁的文字,多种闪烁效果 https://github.com/Zws-China/WSShiningLabel WSShiningLabel *label1 = [[WSShiningLabel alloc] init]; label1.frame = CGRectMake(50, 35, 200, 25); label1.text = @"当保护你的她"; label1.textColor = [UIColor grayColor]; label1.font = [UIFont systemFontOfSize:20]; [label1 startShimmer]; // 开启闪烁 [self.view addSubview:label1]; WSShiningLabel *label2 = [[WSShiningLabel alloc] init]; label2.frame = CGRectMake(50, 105, 200, 25); label2.text = @"变成要你保护的她"; label2.textColor = [UIColor grayColor]; label2.font = [UIFont systemFontOfSize:20]; label2.shimmerType = ST_RightToLeft; // 滚动方向 right to left label2.durationTime = 1; // 滚动时间 label2.shimmerColor = [UIColor orangeColor]; // 高亮颜色 [label2 startShimmer]; // 开启闪烁 [self.view addSubview:label2]; WSShiningLabel *label3 = [[WSShiningLabel alloc] init]; label3.frame = CGRectMake(50, 175, 200, 25); label3.text = @"当你远离了家"; label3.textColor = [UIColor grayColor]; label3.font = [UIFont systemFontOfSize:20]; label3.shimmerType = ST_AutoReverse; // 滚动方向 左右来回 label3.shimmerWidth = 20; // 高亮的宽度 label3.shimmerRadius = 20; // 阴影的宽度 label3.shimmerColor = [UIColor yellowColor]; // 高亮颜色 [label3 startShimmer]; // 开启闪烁 [self.view addSubview:label3]; WSShiningLabel *label4 = [[WSShiningLabel alloc] init]; label4.frame = CGRectMake(50, 245, 200, 25); label4.text = @"努力有了你爱的她"; label4.textColor = [UIColor grayColor]; label4.font = [UIFont systemFontOfSize:20]; label4.shimmerType = ST_ShimmerAll; // 闪烁 label4.durationTime = 0.8; label4.shimmerColor = [UIColor redColor]; [label4 startShimmer]; [self.view addSubview:label4];
1024app_ios_2.3.4是一款专为iOS设备设计的应用程序,其版本号为2.3.4。该应用程序在功能上提供了丰富的内容和服务,可以满足用户在不同方面的需求。 1024app_ios_2.3.4首先具备了强大的应用市场功能,用户可以通过该应用程序方便地浏览和搜索各种类型的应用,包括游戏、社交媒体、工具类等。用户可以根据自己的兴趣和需求下载和安装这些应用,并在手机上进行使用。 其次,1024app_ios_2.3.4还提供了个性化推荐功能,根据用户的使用习惯和喜好,推荐适合用户的应用程序。这样,用户可以更加高效地发现和使用他们感兴趣的应用,提高了用户体验。 另外,1024app_ios_2.3.4还支持应用的更新和升级。用户可以在应用程序中获得关于已安装应用的最新版本信息,并进行更新。这样,用户可以及时获得应用程序的最新功能和修复bug,提高了应用的稳定性和安全性。 最后,1024app_ios_2.3.4还具备了一些额外的功能,例如用户可以在应用中进行应用评分和评论,与其他用户交流和分享使用心得。此外,用户还可以通过该应用程序获取关于应用的详细信息,如应用的大小、开发者介绍等。 综上所述,1024app_ios_2.3.4是一款功能强大的iOS应用程序,用户可以在其中浏览和下载各种类型的应用,享受个性化推荐、应用更新和升级等服务。同时,用户还可以与其他用户互动交流,获取应用的详细信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值