//
// AppDelegate.m
// NiHongPractice
// #import "AppDelegate.h"
#define kColorValue arc4random_uniform(256) / 255.0
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height @interface AppDelegate () @end @implementation AppDelegate - (void)dealloc
{
self.window = nil; [super dealloc]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible]; for (int i = 0; i < 11; i++) { UIView *view = [[UIView alloc] initWithFrame:CGRectMake(15*i, 15*i, kScreenWidth - 30 * i, kScreenHeight - 30 * i)]; // 色值的范围(0~255)
view.backgroundColor = [UIColor colorWithRed:kColorValue green:kColorValue blue:kColorValue alpha:1]; view.tag = 200 + i; [self.window addSubview:view]; [view release]; } [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(changeColor) userInfo:nil repeats:YES]; // 每过一秒去调用changeColor方法,进行一次颜色转换 //[self changeColor]; return YES;
} - (void)changeColor { UIColor *color = [self.window viewWithTag:200 + 10].backgroundColor; for (int i = 10; i >= 0; i--) { [self.window viewWithTag:200 + i].backgroundColor = [self.window viewWithTag:200 + i - 1].backgroundColor; // 先创建的tag值小,结果显示为由外向里转换颜色 } [self.window viewWithTag:200].backgroundColor = color; }

UIVIew之霓虹灯实现的更多相关文章

  1. UIView、UIViewLayout&nbsp;UI_01

    1.首先:在UI里面我们使用的是MRC,需要把ARC改成NO: 若学习比较吃力,可以先学习一下基础: http://blog.sina.com.cn/s/blog_814ecfa90102vuzg.h ...

  2. UIView的layoutSubviews和drawRect方法何时调用

    首先两个方法都是异步执行.layoutSubviews方便数据计算,drawRect方便视图重绘. layoutSubviews在以下情况下会被调用: 1.init初始化不会触发layoutSubvi ...

  3. iOS 自定义方法 - UIView扩展

    示例代码 //#import <UIKit/UIKit.h>@interface UIView (LPCView)/** 上 */@property CGFloat top;/** 下 * ...

  4. UIView上的控件使用push方法跳转

    有时候在项目中,为了保持前后页面的推进方式跳转方式一致,会在通过UIview上的控件跳到另一个Controller上,所以,这时候就需要用到这种方式了,当然,present方法可以实现跳转但是样式可能 ...

  5. IOS 杂笔-11(实现在外部无法改变UIView的size)

    我想题目说的或许不是很清楚,那么现在我详细介绍一下这篇随笔内容. 在外部无法改变UIVIew控件的size. 这里说是UIView,但是事实上,是大多数控件而绝非仅UIView. 想要实现在外部无法改 ...

  6. iOS系列 基础篇 05 视图鼻祖 - UIView

    iOS系列 基础篇 05 视图鼻祖 - UIView 目录: UIView“家族” 应用界面的构建层次 视图分类 最后 在Cocoa和Cocoa Touch框架中,“根”类时NSObject类.同样, ...

  7. 5. UIView

    1. UIView 的初认识 官方文档 UIView class defines a rectangular area on the screen and the interfaces for man ...

  8. Swift - UIView,UItableView,Cell设置边框方法

    // 设置边框的宽度 cell.layer.borderWidth = 1 // 设置边框的颜色 cell.layer.borderColor = UIColor.blackColor().CGCol ...

  9. iOS 使点击事件穿透透明的UIView

    如图: 悬浮的三个按钮下方有一个可以点击的灰色区域,但是点击按钮之间的透明区域, 这三个按钮的contentView会响应这个点击事件,这时候需要让这个contentView不响应这个点击事件. 解决 ...

随机推荐

  1. Quartz2D使用

    使用Quartz2D前  先导入QuartzCore.framework //划线 //1.获取图形上下文 CGContextRef ctx=UIGraphicsGetCurrentContext() ...

  2. java线程同步问题

    Java面试当中,线程可以说是必考内容,在看面试题的时候发现一遍很全的讲解Java面试题的博客:http://blog.csdn.net/csh624366188/article/details/80 ...

  3. android 休眠唤醒机制分析(二) — early_suspend

    本文转自:http://blog.csdn.net/g_salamander/article/details/7982170 early_suspend是Android休眠流程的第一阶段即浅度休眠,不 ...

  4. StateListDrawable 资源

    StateListDrawable 用于组织多个 Drawable 对象.当使用 StateListDrawable 作为目标组件 的背景.前景图片时,StateListDrawable 对象所显示的 ...

  5. Android 仿QQ微信开场导航以及登陆界面

    相信大家对于微信等社交应用的UI界面已经都很熟悉了,该UI最值得借鉴的莫过于第一次使用的时候一些列产品介绍的图片,可以左右滑动浏览,最后进入应 用,这一效果适用于多种项目中,相信今后开发应用一定会用得 ...

  6. Minimum Depth of Binary Tree ——LeetCode

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...

  7. Java的内存管理与内存泄露

    作为Internet最流行的编程语言之一,Java现正非常流行.我们的网络应用程序就主要采用Java语言开发,大体上分为客户端.服务器和数据库三个层次.在进入测试过程中,我们发现有一个程序模块系统内存 ...

  8. Android新浪微博客户端(五)——主界面的TabHost和WeiboUtil

    原文出自:方杰|http://fangjie.info/?p=183转载请注明出处 最终效果演示:http://fangjie.info/?page_id=54 该项目代码已经放到github:htt ...

  9. SDL_PingGe 1.2

    加入了像素填充函数,必须要在一个指定颜色的边界范围内,边界必须没有缺口. 加入了鼠标类 /* typedef void (*FUNCTION)(void); HMODULE HDll; HDll = ...

  10. Matlab:回归分析(2)

    方法一:直接用多元二项式回归 %数据输入 x1 = [ ]; x2 = [ ]; %多元二项式回归函数 y = [ ]; X = [x1' x2']; Y = y'; rstool(X, Y, 'pu ...