首页 / IOS / 蓝懿IOS实战音乐播放器
蓝懿IOS实战音乐播放器
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了蓝懿IOS实战音乐播放器,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2704字,纯文字阅读大概需要4分钟。
内容图文
今天刘国斌老师教了实战的一个demo,仿写音乐播放器
// 1、 如果在viewcontroller里跳转到别的页面里,另一个viewcontroller是storyboard拖出来的,初始化页面需要用self.stroy 再调用方法,instantiateViewControllerWithIdentifier
// 2、 但是如果在其他的页面不是viewcontroller里再跳转到另一个页面,那个页面也是用stroyboard拖出来的,那么就要用 UIStoryboard 通过自己的mainstoryboard标记“Main”先创建一个对象,在用这个对象去初始化另一个页面
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
// 宏定义自动获取的屏幕的尺寸
#define SCREEN_SIZE [UIScreen mainScreen].bounds.size
// 功能实现从第一个页面跳转到tabbarcontroller
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIScrollView *sc=[[UIScrollView alloc]initWithFrame:[UIScreen mainScreen].bounds];
sc.pagingEnabled=YES;
for (int i=0; i<5; i++) {
UIImageView *iv=[[UIImageViewalloc]initWithFrame:CGRectMake(i*SCREEN_SIZE.width, 0, SCREEN_SIZE.width, SCREEN_SIZE.height)];
iv.image=[UIImage imageNamed:[NSStringstringWithFormat:@"Welcome_3.0_%d.jpg",i+1]];
[sc addSubview:iv];
}
CGRect bnFram=CGRectMake(0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height);
UIButton *bn=[[UIButton alloc]initWithFrame:bnFram];
[bn addTarget:self action:@selector(moo) forControlEvents:UIControlEventTouchUpInside];
[sc addSubview:bn];
sc.delegate=self;
// 考虑到屏幕尺寸适配问题,这里的内容contentSize取动态的
sc.contentSize=CGSizeMake(5*SCREEN_SIZE.width, 667);
[self.view addSubview:sc];
}
-(void)moo{
tabONe *ta1=[tabONe new];
ta1.view.backgroundColor=[UIColor colorWithRed:.5 green:.5 blue:.6 alpha:.7];
ta1.title=@"原谅我这一生放荡不羁";
UINavigationController *nv1=[[UINavigationControlleralloc]initWithRootViewController:ta1];
nv1.tabBarItem.title=@"我的音乐";
nv1.tabBarItem.image=[UIImage imageNamed:@"tabbar_item_my_music.png"];
tabTwo *ta2=[tabTwo new];
ta2.view.backgroundColor=[UIColor redColor];
ta2.title=@"辣么屌";
UINavigationController *nv2=[[UINavigationControlleralloc]initWithRootViewController:ta2];
nv2.tabBarItem.title=@"网络";
nv2.tabBarItem.image=[UIImage imageNamed:@"tabbar_item_selected"];
tabThree *ta3=[tabThree new];
ta3.title=@"没文化,读书";
ta3.view.backgroundColor=[UIColor blueColor];
UINavigationController *nv3=[[UINavigationControlleralloc]initWithRootViewController:ta3];
nv3.tabBarItem.title=@"本地";
nv3.tabBarItem.image=[UIImage imageNamed:@"tabbar_item_store_selected.png"];
tabFour *ta4=[tabFour new];
ta4.title=@"多么痛的领悟";
ta4.view.backgroundColor=[UIColor greenColor];
UINavigationController *nv4=[[UINavigationControlleralloc]initWithRootViewController:ta4];
nv4.tabBarItem.title=@"更多";
nv4.tabBarItem.image=[UIImage imageNamed:@"tabbar_item_more.png"];
UITabBarController *tabBar=[[UITabBarController alloc]init];
tabBar.viewControllers=@[nv1,nv2,nv3,nv4];
[self presentViewController:tabBar animated:YES completion:nil];
}
原文:http://www.cnblogs.com/lanyisanqqi/p/5178314.html
内容总结
以上是互联网集市为您收集整理的蓝懿IOS实战音乐播放器全部内容,希望文章能够帮你解决蓝懿IOS实战音乐播放器所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。