七彩霓虹灯能够实现两种效果(更新版本号2)

版本号二效果图;(含应用图标)(此代码临时不显示应用图标,假设须要源代码,email:[email protected])

版本号一效果图:

//  MHTAppDelegate.h

//  NeonLamp

//  Copyright (c) 2014年 Summer. All rights reserved.

#import<UIKit/UIKit.h>

@interface MHTAppDelegate :UIResponder <UIApplicationDelegate>

@property (retain,nonatomic)
UIWindow *window;

@end

//  MHTAppDelegate.m

//NeonLamp

//  Copyright (c) 2014年 Summer. All rights reserved.

#import
"MHTAppDelegate.h"

@interface MHTAppDelegate()

{

UIView *_containerView;

UIView *_toOutsideView;

UIView *_toInsideView;

UIView *_otherView;

UIView *_view;

NSArray *_color;

NSTimer *_timer;

}

@end

@implementation MHTAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

self.window = [[UIWindow
alloc] initWithFrame:[[UIScreen
mainScreen] bounds]];

// Override point for customization after application launch.

_color = [NSArray
arrayWithObjects:[UIColor
redColor], [UIColor
orangeColor], [UIColor
yellowColor], [UIColor
greenColor], [UIColor
blueColor], [UIColor
cyanColor], [UIColor
purpleColor], nil];

//创建背景画布

_containerView = [[UIView
alloc] initWithFrame:CGRectMake(0,
0, 320,
480)];

_containerView.backgroundColor = [UIColor
clearColor];

[self.window
addSubview:_containerView];

[_containerView
release];

_toOutsideView = [[UIView
alloc] initWithFrame:CGRectMake(0,
0, 320,
480)];

_toOutsideView.backgroundColor = [UIColor
clearColor];

[_containerView
addSubview:_toOutsideView];

_toOutsideView.tag =
100;

[_toOutsideView
release];

_toInsideView = [[UIView
alloc] initWithFrame:CGRectMake(0,
0, 320,
480)];

_toInsideView.backgroundColor = [UIColor
clearColor];

[_containerView
addSubview:_toInsideView];

_toInsideView.tag =
101;

[_toInsideView
release];

[self
toIN];

[self
toOUT];

[self
but];

[self
Line];

_timer = [NSTimer
scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(click)
userInfo:nil
repeats:YES];

self.window.backgroundColor = [UIColor
whiteColor];

[self.window
makeKeyAndVisible];

return YES;

}

- (void)toIN

{

for (int i = 0; i <
7; i++) {

UIView *view = [[UIView alloc]
initWithFrame:CGRectMake(10 +
25 * i, 80 + 25 * i,
300 - (0 + 25 * i) *
2, 300 - (25 * i) *
2)];

view.backgroundColor = [_color
objectAtIndex:i];

[_toInsideView
addSubview:view];

[view
release];

view.tag =
200 + i;

}

NSLog(@"%@", [_toInsideView
subviews]);

}

- (void)toOUT

{

for (int i = 0; i <
7; i++) {

UIView *view = [[UIView alloc]
initWithFrame:CGRectMake(10 +
25 * i, 80 + 25 * i,
300 - (0 + 25 * i) *
2, 300 - (25 * i) *
2)];

view.backgroundColor = [_color
objectAtIndex:i];

[_toOutsideView
addSubview:view];

[view
release];

view.tag =
200 + i;

}

NSLog(@"%@", [_toOutsideView
subviews]);

}

- (void)but

{

UIButton *but = [UIButton
buttonWithType:UIButtonTypeCustom];

but.frame =
CGRectMake(10, 390,
300, 40);

[but
setTitle:@"切 
换  效 
果" forState:UIControlStateNormal];

but.titleLabel.font = [UIFont
fontWithName:@"EuphemiaUCAS"
size:20 ];

[but
setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];

but.backgroundColor = [UIColor
yellowColor];

but.layer.cornerRadius =
5;

but.layer.borderWidth =
1;

but.layer.borderColor = [[UIColor
blueColor] CGColor];

[but
addTarget:self
action:@selector(butClick:)
forControlEvents:UIControlEventTouchUpInside];

[_containerView
addSubview:but];

but.tag =
104;

}

- (void)butClick:(UIButton *)but

{

[_containerView
exchangeSubviewAtIndex:0
withSubviewAtIndex:1];

}

- (void)click

{

//由里向外

UIView *temp = [[UIView alloc]
init];

temp.backgroundColor = [_toOutsideView
viewWithTag:200].backgroundColor;

for (int i = 200; i <
206; i++) {

[_toOutsideView
viewWithTag:i].backgroundColor = [_toOutsideView
viewWithTag: i + 1].backgroundColor;

}

[_toOutsideView
viewWithTag:206].backgroundColor =temp.backgroundColor;

[temp
release];

//由外向里

UIView *temp1 = [[UIView alloc]
init];

temp1.backgroundColor = [_toInsideView
viewWithTag:206].backgroundColor;

for (int i = 206; i >
200; i--) {

[_toInsideView
viewWithTag:i].backgroundColor = [_toInsideView
viewWithTag:i - 1].backgroundColor;

}

[_toInsideView
viewWithTag:200].backgroundColor = temp1.backgroundColor;

[temp1
release];

}

- (void)Line

{

//设置切割线

UILabel *hintLine = [[UILabel alloc]
initWithFrame:CGRectMake(10,
60, 290, 2)];

hintLine.backgroundColor = [UIColor
grayColor];

hintLine.layer.cornerRadius =
5;

hintLine.layer.masksToBounds =
YES;

[_containerView
addSubview:hintLine];

[hintLine
release];

//设置功能的提示内容

UILabel *hintLable = [[UILabel alloc]
initWithFrame:CGRectMake(10,
35, 290, 20)];

hintLable.textAlignment =
NSTextAlignmentCenter;

hintLable.text =
@"Neon effect chart:";

hintLable.font = [UIFont
fontWithName:@"AlNile"
size:12];

[_containerView
addSubview:hintLable];

[hintLable
release];

//copyrightLine(版权)

UILabel *copyrightLine = [[UILabel
alloc] initWithFrame:CGRectMake(10,
470, 300, 2)];

copyrightLine.backgroundColor = [UIColor
grayColor];

copyrightLine.layer.cornerRadius =
5;

copyrightLine.layer.masksToBounds =
YES;

[_containerView
addSubview:copyrightLine];

[copyrightLine
release];

UILabel *copyrightLable = [[UILabel
alloc] initWithFrame:CGRectMake(10,
440, 290, 15)];

copyrightLable.textAlignment =
NSTextAlignmentCenter;

copyrightLable.text =
@"Copyright ? 2014 summer";

copyrightLable.font = [UIFont
fontWithName:@"AppleSDGothicNeo-Thin"
size:12];

[_containerView
addSubview:copyrightLable];

[copyrightLable
release];

UILabel *copyrightLable1 = [[UILabel
alloc] initWithFrame:CGRectMake(10,
455, 290, 15)];

copyrightLable1.textAlignment =
NSTextAlignmentCenter;

copyrightLable1.text =
@"[email protected]";

copyrightLable1.font = [UIFont
fontWithName:@"AppleSDGothicNeo-Thin"
size:12];

[_containerView
addSubview:copyrightLable1];

[copyrightLable1
release];

}

- (void)applicationWillResignActive:(UIApplication *)application

{

// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition
to the background state.

// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

}

- (void)applicationDidEnterBackground:(UIApplication *)application

{

// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.

// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}

- (void)applicationWillEnterForeground:(UIApplication *)application

{

// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

}

- (void)applicationDidBecomeActive:(UIApplication *)application

{

// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

}

- (void)applicationWillTerminate:(UIApplication *)application

{

// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}

- (void)dealloc

{

self.window = nil;

[super dealloc];

}

@end

时间: 2024-10-01 07:17:37

七彩霓虹灯能够实现两种效果(更新版本号2)的相关文章

七彩霓虹灯可以实现两种效果

//  MHTAppDelegate.h //  HomeworkNeonLamp //  Copyright (c) 2014年 Summer. All rights reserved. #import <UIKit/UIKit.h> @interface MHTAppDelegate : UIResponder <UIApplicationDelegate> @property (retain, nonatomic) UIWindow *window; @end //  MHT

Javscript轮播 支持平滑和渐隐两种效果(可以只有两张图)

先上两种轮播效果:渐隐和移动 效果一:渐隐 1 2 3 4 效果二:移动 1 2 3 4 接下来,我们来大致说下整个轮播的思路: 一.先来看简单的,移动的,先上来一个图----移动效果图: 说明: 基本原则就是顺序是按照当前显示的为基准:如当前为2,那么顺序就是2,3,4,1:如当前为3,那么顺序就是3,4,1,2.以此类推. 整个移动划分为三种:1.下一个  2.上一个  3.任意个      1.下一个:margin-left:-图宽:然后将“图1”移到最后一个位置 next: functi

自绘ListBox的两种效果

本文利用Listbox自绘实现了两种特殊效果(见图),左边的风格是自己突然灵感触发想到的,右边的风格来自"C++ Builder 研究"的一个帖子,老妖用BCB实现了,这里则用Delphi实现它. 演示图片: //-------------------------------------------------------------------------- unit DrawListItem; interface uses  Windows, Messages, SysUtils, Vari

38Echarts环状图两种效果

一.多数据环```html:run<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Echarts环状图效果</title> <script type="text/javascript" src="https://cdn.bootcss.com/echarts/3.7.1/e

Javscript轮播-----支持平滑和渐隐两种效果

先看效果

DataGridView编辑后立即更新到数据库的两种方法

DataGridView控件是微软预先写好的一个显示数据的控件,功能非常强大,可以显示来自数据库表的数据和XML等其他来源的数据.最近在做一个迷你超市管理系统,要大量用到这个控件.所以花时间好好研究了下. 这是迷你超市管理系的库存数据DataGridView,用户一定会想如果能直接在DGV中修改数据就好了. 是的,这是一个很好的想法,这个功能微软早就帮我们想到了,现在可以使两种方法加以实现.下面就来介绍一下他们. 第一张方法:基于DataAdapter对象创建一个CommandBulider,用

【Android UI设计与开发】第14期:顶部标题栏(五)两种方式实现仿微信标题栏弹窗效果

转载请注明出处:http://blog.csdn.net/yangyu20121224/article/details/9093821         博主在这篇文章中将会继续围绕顶部标题栏专题来进行实例讲解,今天要讲解的主题是分别使用PopupWindow和Activity两种不同的方式来实现仿微信顶部标题栏弹窗的这样一个效果. 一.实现效果图 这里为了演示方便,我将两种方法放在一个应用程序中演示,这个是主界面 虽然两种实现的方式不一样,但是最终的效果图都是差不多的     二.项目结构图  

Android 两种方式实现类似水波扩散效果

原文链接 https://mp.weixin.qq.com/s/M19tp_ShOO6esKdozi7Nlg 两种方式实现类似水波扩散效果,先上图为敬 自定义view实现 动画实现 自定义view实现 思路分析:通过canvas画圆,每次改变圆半径和透明度,当半径达到一定程度,再次从中心开始绘圆,达到不同层级的效果,通过不断绘制达到view扩散效果 private Paint centerPaint; //中心圆paint private int radius = 100; //中心圆半径 pr

Android第五期 - 更新自己的apk本地与网络两种方法

首先是本地: ParseXmlService部分: package com.szy.update; import java.io.InputStream; import java.util.HashMap; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element