学了两天IOS趁着还没忘光,巩固一下所学知识想做点东西,由于自己的设计能力有限,所以就山寨一下吧,说到山寨怎么能忘了腾讯呢,今天发现QQ音乐的设计风格是扁平化的,小清新风格,所以就山寨一下它吧。。

由于本屌没有IPhone手机只能用Ipad运行iphone应用看看QQ音乐的效果,我的ipad是ios7的不知道QQ音乐是不是在IOS6上也是这种风格(想来肯定是的,腾讯的设计能力还是挺厉害的,山寨也是需要实力的不是)。

下面来真格的。。。。


首先是层次,据我观察是一个UITabBarController下面包含四个UINavigationController,每个UINavigationController下面包含UITableViewController(我也不知道对不对,反正我就这么做了)

接下来我们建立一个空的Project新建一个类继承自UITabBarController,这里我就叫RootViewController,然后再Window的代理类中将window的根控制器设置为我们新建的rootViewController,

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor]; RootViewController *rootViewController = [[RootViewController alloc] init];
[self.window setRootViewController:rootViewController]; //设置跟控制器为我们新建的RootViewController,其实就是设置为UITabBarController [self.window makeKeyAndVisible];
return YES;
}

然后就是在UITabBarController中设置四个UINavigationController主要实现代码如下

     //设置UItabBar的高度为50
self.tabBar.frame = CGRectMake(, CGRectGetHeight([[UIScreen mainScreen] bounds]) - , CGRectGetWidth([[UIScreen mainScreen] bounds]), ); if (IOS_7) {
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], UITextAttributeTextColor, [UIFont fontWithName:@"Arial" size:0.0], UITextAttributeFont,nil] forState:UIControlStateHighlighted]; //设置UITabBarItem高亮时title的颜色为白色
}
else{
[[UITabBar appearance] setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor] size:CGSizeMake(, )]]; //使用纯色图片填充IOS默认的UITabBar
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage new]];//去掉IOS6选中时的高光效果
//设置IOS6的UINagitationBar的颜色为白色
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor] size:CGSizeMake(, )] forBarMetrics:UIBarMetricsDefault];
} //Universal
//设置IOS6和IOS7的UINavigationBar上的字体统一为黑色
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor], UITextAttributeTextColor, [UIFont fontWithName:@"Arial" size: ], UITextAttributeFont, [UIFont boldSystemFontOfSize:], NSFontAttributeName, [NSValue valueWithUIOffset:UIOffsetZero], UITextAttributeTextShadowOffset, nil]]; //我的音乐
MyMusicViewController *myMusicView = [[MyMusicViewController alloc] init];
UINavigationController *myMusicNavigation = [[UINavigationController alloc] initWithRootViewController:myMusicView];
myMusicNavigation.tabBarItem = [UITabBarItem initCustomWithImage:@"mymusic" withSelectedImage:@"mymusicSelected" withTitle:@"我的音乐"]; //音乐馆
MusicHallViewController *musicHallView = [[MusicHallViewController alloc] init];
UINavigationController *musicHallNavigation = [[UINavigationController alloc] initWithRootViewController:musicHallView];
musicHallNavigation.tabBarItem = [UITabBarItem initCustomWithImage:@"musicHall" withSelectedImage:@"musicHallSelected" withTitle:@"音乐馆"]; //发现
FinderViewController *finderView = [[FinderViewController alloc] init];
UINavigationController *finderNavigation = [[UINavigationController alloc] initWithRootViewController:finderView];
finderNavigation.tabBarItem = [UITabBarItem initCustomWithImage:@"finder" withSelectedImage:@"finderSelected" withTitle:@"发现"]; //更多
MoreViewController *moreView = [[MoreViewController alloc] init];
UINavigationController * moreNavigation = [[UINavigationController alloc] initWithRootViewController:moreView];
moreNavigation.tabBarItem = [UITabBarItem initCustomWithImage:@"more" withSelectedImage:@"moreSelected" withTitle:@"更多"]; NSArray *viewControllers = [NSArray arrayWithObjects:myMusicNavigation, musicHallNavigation, finderNavigation, moreNavigation, nil];
[self setViewControllers:viewControllers];

代码中的IOS_7是一个宏定义

 #define IOS_7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)

创建UITabBarItem的方法我写在了一个Category中定义了一个类方法

 + (UITabBarItem *) initCustomWithImage:(NSString *)image withSelectedImage:(NSString *)selectedImage withTitle:(NSString *)title
{
UIEdgeInsets insets = UIEdgeInsetsMake(, , -, ); //UITabBarItem的偏移量 上左下右
UIImage *myImage = [UIImage imageNamed:image];
UIImage *myImageSelected = [UIImage imageNamed:selectedImage];
UITabBarItem *myTabBarItem = [[UITabBarItem alloc] init];
myTabBarItem.imageInsets = insets;
myTabBarItem.title = title;
if (IOS_7) {
myTabBarItem.image = [myImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
myTabBarItem.selectedImage = [myImageSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
else
{
[myTabBarItem setFinishedSelectedImage:myImageSelected withFinishedUnselectedImage:myImage];
}
return myTabBarItem;
}

为了在IOS6和IOS7中都是用同样的扁平化风格,需要对IOS6作特别的设置,需要将UINavigationBar和UIBabBar的背景用纯色图片填充,title的字体样式也要设置为统一风格,具体的一下做法可以参考如下博客

http://esoftmobile.com/2014/01/14/build-ios6-ios7-apps/

由于初学 水平有限 刚开了个头 写了个初步布局 先到这里 还有一些问题没有解决 来张图片

 

虽然IOS6和IOS7是初步统一了样式,但是官方的我的音乐是在左边的,不知道怎么弄过去了。。。,请高人赐教。。。

山寨QQ音乐的布局(一)的更多相关文章

  1. 山寨QQ音乐的布局(二)终于把IOS6的UITableView拍扁了

    IOS应用开发中UITableView的应用十分广泛,但是IOS7神一样的把UITableView拍扁了,这样一来IOS6的UITableView不干了,就吵着也要被拍扁,那好吧我今天就成全了你... ...

  2. 高仿手机QQ音乐之——Android带进度条的开关

    最新版的手机QQ音乐体验确实不错,发现首页播放按钮能够显示歌曲当前进度条.认为挺有新意.效果例如以下: 自己琢磨了下.能够用自己定义组件来实现,试着做了一下.效果例如以下: 整理了下思路.大概设计流程 ...

  3. 前端练手小项目——网页版qq音乐仿写

    qq音乐网页版仿写 一些步骤与注意事项 一开始肯定就是html+css布局和页面了,这段特别耗时间,耐心写完就好了 首先要说一下大致流程: 一定要先布局html!,所以一定要先分析页面布局情况,用不同 ...

  4. (DNS被劫持所导致的)QQ音乐与视频网页打开很慢的解决方法

    这周开始发现一个很让人抓狂的现象,QQ音乐网页(http://y.qq.com)与QQ视频(http://v.qq.com/)网页打开超慢,甚至是无法打开,严重影响了业余的音乐视频生活. 以QQ视频为 ...

  5. 使用网易云音乐,丢掉QQ音乐吧

    我是一个听音乐的重度用户,基本上每天大约有三分之一的时间里我在使用网易云音乐去听音乐.包括工作写代码的时候,跑步的时候,去上班的途中我都去听.首先需要声明的是,在这里我不是故意的去抹黑其他的音乐产品, ...

  6. QQ音乐的各种相关API

    QQ音乐的各种相关API 分类: oc2014-01-29 15:34 2676人阅读 评论(2) 收藏 举报 基本上论坛里做在线音乐的都在用百度的API,进来发现百度的API不仅歌曲的质量不可以保证 ...

  7. 【QQ音乐Api】移花接木 打造自己的音乐电台

    最近突发奇想想做个在线音乐小网页.需求很简单,如下 搜索歌曲 或 歌手 在线播放音乐 借用qq 或者 百度的 音乐接口 需求明确那就直接动手了 我首先尝试的百度音乐,但是不能在线播放(提示forbid ...

  8. QQ音乐项目(OC版) - 实现细节

    QQ 音乐看似简单,但自己手动实现起来,才发现没有那么简单,有好多细节,需要注意. github : https://github.com/keenleung/QQMusic-OC 一.业务逻辑 首先 ...

  9. QQ音乐API

    今天分享的是QQ音乐API 搜索歌曲API:http://s.music.qq.com/fcgi-bin/music_search_new_platform?t=0& amp;n={2}&am ...

随机推荐

  1. BNUOJ flower (搜索)

    春天到了,师大的园丁们又开始忙碌起来了. 京师广场上有一块空地,边界围成了一个多边形,内部被划分成一格一格的.园丁们想在这个多边形内的每一格内种植一些花. 现在请你帮忙计算一下一共最多可以种多少花. ...

  2. 无法添加sql server ER图

    Database diagram support objects cannot be installed because this database does not have a valid own ...

  3. linux下休眠/待机命令

    http://blog.csdn.net/hshl1214/article/details/6228275

  4. 【Xamarin挖墙脚系列:代码手写UI,xib和StoryBoard间的博弈,以及Interface Builder的一些小技巧(转)】

    正愁如何选择构建项目中的视图呢,现在官方推荐画板 Storybord...但是好像 xib貌似更胜一筹.以前的老棒子总喜欢装吊,用代码写....用代码堆一个HTML页面不知道你们尝试过没有.等页面做出 ...

  5. Ice笔记-利用Ice::Application类简化Ice应用

    Ice笔记-利用Ice::Application类简化Ice应用 作者:ydogg,转载请申明. 在编写Ice相关应用时,无论是Client还是Server端,都必须进行一些必要的动作,如:Ice通信 ...

  6. UESTC_我要长高 CDOJ 594

    韩父有N个儿子,分别是韩一,韩二…韩N.由于韩家演技功底深厚,加上他们间的密切配合,演出获得了巨大成功,票房甚至高达2000万.舟子是名很有威望的公知,可是他表面上两袖清风实则内心阴暗,看到韩家红红火 ...

  7. 使用sae定时执行Python脚本

    使用sae定时执行Python脚本 使用sae定时执行Python脚本 12,May,2014 | 57 Views 毕设压力略大,必须是桂林游的锅.去之前放松了几天,回来又休闲了几天,加上桂林的一周 ...

  8. iOS 实时监听app的网络连接状态

    实际iOS开发中,在网络通信中我们大部分使用第三方(只谈短链),譬如 AFNetworking.ASIHttpRequest(这个停更了,想必现在没多少人用),swift的 Alamofire 等. ...

  9. 评教数据整理专用VBA小程序

    这次评教的所有数据存放在两个数据库中,比如说给某教师评论的学生有100个,可是结果有40个的数据在数据库A中,另外60人的数据在数据库B中.那么,如何将两个库中的数据整合,最后得到教师的准确成绩成为了 ...

  10. Unity 4.6 uGUI的点击事件

    因为Unity 4.6刚刚发布,自带的uGUI功能的相关资料还不是很完善,今天刚装的Unity 4.6,想看一下uGUI是否好用,那么开始就今天的学习吧啊! 1,新建一个空的工程.