学习总结5

经过五周的学习,作者从零开始掌握了iOS开发的基础,并通过实践项目——模仿QQ音乐的应用,深入了解了架构的重要性和知识整合的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

开始学习IOS已经五周了,从无到有,慢慢的学会了很多东西。这周的学习比起以往有更多的收获,学习做了一个模仿QQ音乐的程序,从中知道了什么是架构以及架构的重要性。 很多东西都不会,但是通过做一个稍微完整的项目,可以开始学会资源整合,学习过的知识的综合应用。下面附上作业的代码,虽然还有很多需要改进的地方,但已经是一个质的跨越。 学习就是一个积累的过程,不会的东西越多,学到的东西也就越多。有一个好的学习环境至关重要。有环境的保护,加上自己的努力,一定能迈进大神的行列。 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor = [UIColor grayColor]; [self.window makeKeyAndVisible]; UIImage *img1 = [UIImage imageNamed:@"wanglihong.jpg"]; UIImage *img2 = [UIImage imageNamed:@"jay.jpg"]; UIImage *img3 = [UIImage imageNamed:@"gem.jpeg"]; UIImage *img4 = [UIImage imageNamed:@"gaga.jpg"]; UIImage *img5 = [UIImage imageNamed:@"chenyixun.jpg"]; arr = [[NSMutableArray alloc]initWithObjects:img1,img2,img3,img4,img5, nil]; music = [[NSMutableArray alloc]initWithObjects:@"你不知道的事",@"七里香",@"多远都要在一起",@"Bad Romance",@"浮夸", nil]; singer = [[NSMutableArray alloc ]initWithObjects:@"王力宏",@"周杰伦-Jay",@"Gem-邓紫棋",@"lady-gaga",@"陈奕迅", nil]; [self _initImageView]; // [self _initView]; NSString *filepath = [[NSBundle mainBundle]pathForResource:music[i] ofType:@"mp3"]; NSURL *fileUrl = [NSURL fileURLWithPath:filepath]; player = [[AVAudioPlayer alloc]initWithContentsOfURL:fileUrl error:nil]; [player prepareToPlay]; [player play]; timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerAction:) userInfo:nil repeats:1]; return YES; } #pragma mark -imageView - (void)_initImageView { //imageview视图 imgView = [[UIImageView alloc ] initWithFrame:CGRectMake(0, 20, 375, 667)]; imgView.backgroundColor = [UIColor yellowColor]; UIImage *image = [UIImage imageNamed:@"audio_bg-Decoded.png"]; imgView.image = image; imgView.userInteractionEnabled = YES; //设置内容模式 imgView.contentMode = UIViewContentModeScaleToFill; //中间的视图 UIImageView *centerView = [[UIImageView alloc ] initWithFrame:CGRectMake(67.5, 170, 260, 280)]; UIImage *image1 = [UIImage imageNamed:@"audio_cover_bg-Decoded.png"]; centerView.image = image1; centerView.contentMode = UIViewContentModeScaleToFill; [imgView addSubview:centerView]; UIImageView *centerView1 = [[UIImageView alloc ] initWithFrame:CGRectMake(82.5, 184, 230, 250)]; // view1.backgroundColor = [UIColor yellowColor]; UIImage *image2 = [UIImage imageNamed:@"chenyixun.jpg"]; centerView1.image = image2; centerView1.tag = 2; centerView1.contentMode = UIViewContentModeScaleToFill; [imgView addSubview:centerView1]; //-----------Cview---------- cView = [[UIImageView alloc ] initWithFrame:CGRectMake(0, 170, 375, 330)]; cView.userInteractionEnabled = YES; // cView.backgroundColor = [UIColor yellowColor]; [imgView addSubview:cView]; //上面的视图(时间滑块) UIImageView *upView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 375, 183)]; upView.tag = 11; upView.backgroundColor = [UIColor whiteColor]; upView.image = [UIImage imageNamed:@"audio_bg_up-Decoded.png"]; upView.alpha = 0.5; //顶上的视图(退出、收藏) UIImageView *topVIew = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 375, 63)]; topVIew.backgroundColor = [UIColor grayColor]; topVIew.image = [UIImage imageNamed:@"audio_bg_up-Decoded.png"]; topVIew.alpha = 0.7; topVIew.tag = 12; [upView addSubview:topVIew]; [imgView addSubview:upView]; //-------------Oview--------------- oView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 375, 246)]; oView.tag = 1; oView.userInteractionEnabled = YES; [imgView addSubview:oView]; [self _initButton];//-----顶上的按钮 [self _initLabel];//----显示歌名歌手 [self _initSlider];//----时间滑块 //底下的视图 UIImageView *downView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 500, 375, 147)]; downView.tag = 31; downView.backgroundColor = [UIColor whiteColor]; downView.image = [UIImage imageNamed:@"audio_bg_down-Decoded.png"]; downView.alpha = 0.7; downView.userInteractionEnabled = YES; [imgView addSubview:downView]; //---------------Dview------------ dView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 500, 375, 147)]; dView.tag = 3; dView.userInteractionEnabled = YES; [imgView addSubview:dView]; [self _initSliderDowm]; //------音量滑块 [self _initButtonDown]; [self.window addSubview:imgView]; } #pragma maak -buttonClick //退出键触发事件 - (void)topBtn1Click:(UIButton *)topBtn1 { NSLog(@"退出"); } //收藏键触发事件 - (void)topBtn2Click:(UIButton *)topBtn2 { topBtn2.selected = !topBtn2.selected; } //收起 - (void)centerBtnClick:(UIButton *)centerBtn { UIImageView *topView = (UIImageView *)[self.window viewWithTag:1]; topView.hidden =!topView.hidden; UIImageView *downView = (UIImageView *)[self.window viewWithTag:3]; downView.hidden = !downView.hidden; UIImageView *upView = (UIImageView *)[self.window viewWithTag:11]; upView.hidden = !upView.hidden; UIImageView *doView = (UIImageView *)[self.window viewWithTag:31]; doView.hidden = !doView.hidden; [imgView addSubview: topLabel1]; [imgView addSubview: topLabel2]; } - (void)downBtn3Click:(UIButton *)downBtn3 { downBtn3.selected = !downBtn3.selected; if (!downBtn3.selected) { if (lastSeleted != i) { [player play]; // [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerAction:) userInfo:nil repeats:1]; } else{ NSString *filepath = [[NSBundle mainBundle]pathForResource:music[i] ofType:@"mp3"]; NSURL *fileUrl = [NSURL fileURLWithPath:filepath]; player = [[AVAudioPlayer alloc]initWithContentsOfURL:fileUrl error:nil]; [player prepareToPlay]; [player play]; } } else if(downBtn3.selected){ [player pause]; // [timer invalidate]; // return; } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值