#import "AppDelegate.h"
#import "ViewController.h"
#define hangPi @"界世牛大"//宏定义
#define shangLian @"好好学习"
#define xiaLian @"天天向上"
@interface AppDelegate ()
{
UIImageView *imageView;
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
ViewController *vc = [[ViewController alloc]init];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];//让窗口是一个主窗口 并且显示在屏幕上
self.window.backgroundColor = [UIColor whiteColor];
//标签初始化
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(90, 100, 200, 80)];
UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(40, 200, 50, 400)];
UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(290, 200, 50, 400)];
[self.window addSubview:label];
[self.window addSubview:label1];
[self.window addSubview:label2];
//设置标签的颜色
label.backgroundColor = [UIColor redColor];
label1.backgroundColor = [UIColor redColor];
label2.backgroundColor = [UIColor redColor];
//插入文本并设置文本的字体、大小、对其方式等
label.text = hangPi;
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont systemFontOfSize:30];
label1.text = xiaLian;
label1.textAlignment = NSTextAlignmentCenter;
label1.font = [UIFont systemFontOfSize:30];
label1.numberOfLines = 4;
label2.text = shangLian;
label1.textAlignment = NSTextAlignmentCenter;
label2.font = [UIFont systemFontOfSize:30];
label2.numberOfLines = 4;
//插入视图
imageView = [[UIImageView alloc]init];
imageView.frame = CGRectMake(100, 200, 180, 400);
[self.window addSubview:imageView];
imageView.image = [UIImage imageNamed:@"奥黛丽.jpg"];
//延时
[self performSelector:@selector(start) withObject:nil afterDelay:2];
return YES;
}
-(void)start{
UIImage *image1 = [UIImage imageNamed:@"恐怖动画1.tiff"];
UIImage *image2 = [UIImage imageNamed:@"恐怖动画2.tiff"];
NSArray *array = @[image1,image2];
imageView.animationDuration = 1;
imageView.animationImages = array;//给帧动画设置图标素材
imageView.animationRepeatCount = 0;//给动画设置重复次数 0说明无限重复
[imageView startAnimating];
}