zoukankan      html  css  js  c++  java
  • 辉光的UIView

    辉光的UIView

    辉光UIView使用了一个UIView的一个category,名为UIView+Glow,请自行到github上查找.

    源码如下:

    //
    //  RootViewController.m
    //  GlowView
    //
    //  Copyright (c) 2014年 Y.X. All rights reserved.
    //
    
    #import "RootViewController.h"
    #import "UIView+Glow.h"
    #import "FontPool.h"
    
    @interface RootViewController ()
    
    @end
    
    @implementation RootViewController
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        self.view.backgroundColor = [UIColor blackColor];
        
        // 注册字体
        REGISTER_FONT(bundleFont(@"新蒂小丸子体.ttf"), @"新蒂小丸子体");
        
        // name标签
        UILabel *name  = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
        name.text      = @"游贤明";
        name.font      = [UIFont fontWithName:CUSTOM_FONT(@"新蒂小丸子体", 0) size:50];
        name.textColor = [UIColor redColor];
        name.center    = self.view.center;
        [self.view addSubview:name];
        
        // 字幕标签
        UILabel *letters  = [[UILabel alloc] initWithFrame:CGRectMake(170, 230, 200, 200)];
        letters.text      = @"No zuo no die";
        letters.font      = [UIFont fontWithName:CUSTOM_FONT(@"新蒂小丸子体", 0) size:20];
        letters.textColor = [UIColor whiteColor];
        [self.view addSubview:letters];
        
        // 开始辉光
        [name startGlowingWithColor:[UIColor cyanColor]      intensity:1.0f];
        [letters startGlowingWithColor:[UIColor yellowColor] intensity:1.0f];
    }
    
    @end

    效果图如下:

    效果好哦:)

  • 相关阅读:
    面试题:能谈谈Date、Datetime、Time、Timestamp、year的区别吗?
    面试题:对NotNull字段插入Null值 有啥现象?
    聊聊什么是慢查、如何监控?如何排查?
    谈谈MySQL的基数统计
    .vimrc
    HISKrrr的板子库
    CSP 模拟35
    晚测1
    CSP 模拟34
    nim板子题异或正确性YY
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3740533.html
Copyright © 2011-2022 走看看