..还是粘的课上做的笔记
//WebView+Image Animation+Timer //UIBarButton UIBarButtonItem *bar = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemSearch target:self action:@selector(search:)]; self.navigationItem.rightBarButtonItem = bar; // navigationItem中有一些项可以设置为自己定义的控件 //URL _webView.frame = self.view.frame; NSString *str = [NSString stringWithFormat:@"http://www.baidu.com"]; NSURL *url = [NSURL URLWithString:str]; NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; [_webView loadRequest:request]; // 字符串,变为url,发送请求 //UIImageView播放动画 _tomImageView = [[UIImageView alloc] init]; _tomImageView.frame = self.view.frame; _tomImageView.image = [UIImage imageNamed:@"1.jpg"]; NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:10]; for(int i = 0;i<26;i++){ UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"cat_angry%04d.jpg",i]]; [arr addObject:image]; } _tomImageView.animationImages = arr; _tomImageView.animationRepeatCount = 1; _tomImageView.animationDuration = 2.6; [_tomImageView startAnimating]; //Timer self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(change) userInfo:nil repeats:YES];
时间: 2024-11-05 13:33:39