資源簡介
實現了切歌方法,點擊消失導航欄,再點擊導航欄出現,漸變效果,歌曲進度隨著暫停按鈕改變
代碼片段和文件信息
//
//??AppDelegate.m
//??QQMusic-Test
//
//??Created?by?北京暢想未來科技有限公司?on?15/12/7.
//??Copyright???2015年?北京暢想未來科技有限公司.?All?rights?reserved.
//
#import?“AppDelegate.h“
#import?“ViewController.h“
#define?KScreenWidth?[UIScreen?mainScreen].bounds.size.width
#define?KScreenHeight?[UIScreen?mainScreen].bounds.size.height
@interface?AppDelegate?()?{
????
????UIImageView?*_mainView;?????????????????//背景視圖,放歌手圖片
????UIView?*_upView;???????????????????????//導航視圖
????UIView?*_downView;????????????????????//播放欄視圖
????NSMutableArray?*_mscNameArray;???????//歌曲名字數組
????NSMutableArray?*_singerNameArray;???//歌手名字數組
????NSMutableArray?*_backImgArray;?????//背景圖片數組
????NSInteger?_index;?????????????????//設置當前播放歌曲時候的一個值,用來記住當前的歌曲
????NSTimer?*_timer;?????????????????//定時器
}
@end
@implementation?AppDelegate
-?(BOOL)application:(UIApplication?*)application?didFinishLaunchingWithOptions:(NSDictionary?*)launchOptions?{
????//創建窗口
????_window?=?[[UIWindow?alloc]?initWithframe:[UIScreen?mainScreen].bounds];
????[_window?makeKeyAndVisible];
????_window.rootViewController?=?[[ViewController?alloc]?init];
????
???
????
????_index?=?0;
????
????[self?_loadData];
????[self?_backImgView];
????[self?_upView];
????[self?_downView];
????
????
????
????_timer?=?[NSTimer?scheduledTimerWithTimeInterval:1?target:self?selector:@selector(timeAction)?userInfo:nil?repeats:YES];
????
????return?YES;
}
//創建默認背景視圖
-?(void)_backImgView?{
??
????_mainView?=?[[UIImageView?alloc]?init];
????_mainView.userInteractionEnabled?=?YES;??//打開userInteractionEnabled功能,這樣點擊才會觸發事件
????[_window?addSubview:_mainView];
????
????//設置初始狀態
????UIImage?*backImg?=?[UIImage?imageNamed:@“jay.jpg“];
????_mainView.image?=?backImg;
????_mainView.frame?=?[UIScreen?mainScreen].bounds;
????[_window?addSubview:_mainView];
????
????//設置按鈕,點擊清除導航欄
????UIControl?*ctr?=?[[UIControl?alloc]?initWithframe:CGRectMake(0?64?KScreenWidth?KScreenHeight?-?64?-?120)];//frame是除導航欄和播放欄
????ctr.backgroundColor?=?[UIColor?clearColor];//設置成透明
????[ctr?addTarget:self?action:@selector(ctrAction)?forControlEvents:UIControlEventTouchUpInside];
????[_mainView?addSubview:ctr];
}
-?(void)ctrAction?{
????
????//設置alpha,消失效果為漸變
????if?(_upView.alpha?!=?0)?{
????????[UIView?beginAnimations:nil?context:nil];
????????[UIView?setAnimationDuration:0.6];
????????
????????_upView.alpha?=?0;
????????_downView.alpha?=?0;
????????[UIView?commitAnimations];
????}else?{
????????
????????[UIView?beginAnimations:nil?context:nil];
????????[UIView?setAnimationDuration:0.6];
????????
????????_upView.alpha?=?0.6;
????????_downView.alpha?=?0.6;
????????[UIView?commitAnimations];
????}
}
//上面的導航欄
-?(void)_upView?{
????
????_upView?=?[[UIView?alloc]?initWithframe:CGRectMake(0?0?KScreenWidth?64)];
????_upView.backgroundColor?=?[UIColor?colorWithRed:0?green:0?blue:0?alpha:0.6];
????
????//設置初始狀態
????UILabel?*msctitleLabel?=?[[UILabel?alloc]?initWithframe:CGRectMake(0?20?KScreenWidth?25)];
????msctitleLabel.tag?=?102;
????msctitleLabel.textAlignment?=?NST
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-12-09?12:19??QQMusic-Test\
?????文件????????6148??2015-12-30?20:04??QQMusic-Test\.DS_Store
?????目錄???????????0??2015-12-30?20:05??__MACOSX\
?????目錄???????????0??2015-12-30?20:05??__MACOSX\QQMusic-Test\
?????文件?????????120??2015-12-30?20:04??__MACOSX\QQMusic-Test\._.DS_Store
?????目錄???????????0??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\
?????文件?????????336??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\AppDelegate.h
?????目錄???????????0??2015-12-30?20:05??__MACOSX\QQMusic-Test\QQMusic-Test\
?????文件?????????171??2015-12-30?20:04??__MACOSX\QQMusic-Test\QQMusic-Test\._AppDelegate.h
?????文件????????9870??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\AppDelegate.m
?????文件?????????171??2015-12-30?20:04??__MACOSX\QQMusic-Test\QQMusic-Test\._AppDelegate.m
?????目錄???????????0??2015-12-08?17:51??QQMusic-Test\QQMusic-Test\Assets.xcassets\
?????目錄???????????0??2015-12-07?13:58??QQMusic-Test\QQMusic-Test\Assets.xcassets\AppIcon.appiconset\
?????文件?????????585??2015-12-07?13:58??QQMusic-Test\QQMusic-Test\Assets.xcassets\AppIcon.appiconset\Contents.json
?????目錄???????????0??2015-12-30?20:05??__MACOSX\QQMusic-Test\QQMusic-Test\Assets.xcassets\
?????目錄???????????0??2015-12-30?20:05??__MACOSX\QQMusic-Test\QQMusic-Test\Assets.xcassets\AppIcon.appiconset\
?????文件?????????171??2015-12-07?13:58??__MACOSX\QQMusic-Test\QQMusic-Test\Assets.xcassets\AppIcon.appiconset\._Contents.json
?????文件??????????62??2015-12-08?17:51??QQMusic-Test\QQMusic-Test\Assets.xcassets\Contents.json
?????目錄???????????0??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\ba
?????文件????????1662??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\ba
?????文件????????1605??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\ba
?????文件????????1205??2015-12-08?11:06??QQMusic-Test\QQMusic-Test\Info.plist
?????文件?????????213??2015-12-08?11:06??__MACOSX\QQMusic-Test\QQMusic-Test\._Info.plist
?????文件?????????393??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\main.m
?????文件?????????171??2015-12-30?20:04??__MACOSX\QQMusic-Test\QQMusic-Test\._main.m
?????文件?????????704??2015-12-24?19:42??QQMusic-Test\QQMusic-Test\Music.plist
?????文件?????????160??2015-12-24?19:42??__MACOSX\QQMusic-Test\QQMusic-Test\._Music.plist
?????文件?????????319??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\ViewController.h
?????文件?????????171??2015-12-30?20:04??__MACOSX\QQMusic-Test\QQMusic-Test\._ViewController.h
?????文件?????????647??2015-12-30?20:04??QQMusic-Test\QQMusic-Test\ViewController.m
?????文件?????????171??2015-12-30?20:04??__MACOSX\QQMusic-Test\QQMusic-Test\._ViewController.m
............此處省略88個文件信息
- 上一篇:概率、隨機變量與隨機過程 第4版
- 下一篇:WC2018講課課件
評論
共有 條評論