iOS高仿斗鱼项目(OC版)

iOS高精仿�斗鱼(OC)
开发环境:Xcode 7.3.1,语言:Objective-C
用到的工具:Charles
首页

首页 推荐

轮播图
轮播图用的是第三方框架SDCycleScrollView,功能多,简单易用,具体实现看代码
SDCycleScrollView *headView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0,0, [UIScreenmainScreen].bounds.size.width,140) delegate:selfplaceholderImage:[UIImageimageNamed:@"cover_img_default"]];self.headView= headView; headView.pageControlStyle= SDCycleScrollViewPageContolStyleClassic; headView.pageControlAliment= SDCycleScrollViewPageContolAlimentRight; headView.currentPageDotColor= [UIColorcolorWithRed:255/255.0green:121/255.0blue:31/255.0alpha:1.0]; [slide addSubview:headView];NSMutableArray*imageArray = [NSMutableArrayarray];self.imageArray= imageArray;for(Slide_data *iamgesinself.slide.data) { [self.imageArrayaddObject:iamges.pic_url]; }self.headView.imageURLStringsGroup=self.imageArray;

滑动按钮
这个部分是用继承自UICollectionReusableView的一个视图然后再套用collectionView,如果大家有好的想法,可以交流,备注:控制器用的是collectionViewController

collectionView头部
同样继承UICollectionReusableView的视图,再自定义子控件。子控件代码如下 ,用到了masonry约束。
- (instancetype)initWithFrame:(CGRect)frame{if(self= [superinitWithFrame:frame]) { [selfsetupSubviews]; }returnself;}- (void)setupSubviews{UIView*bgView = [[UIViewalloc]init];self.bgView= bgView; [selfaddSubview:bgView]; [bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.left.right.bottom.mas_equalTo(0); }];UIImageView*icon = [[UIImageViewalloc]init];self.icon= icon; [selfaddSubview:icon]; [icon mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(5); make.centerY.mas_equalTo(self.bgView); }];UILabel*titleLabel = [[UILabelalloc]init];self.titleLabel= titleLabel; [selfaddSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(30); make.centerY.mas_equalTo(self.icon); }]; titleLabel.textColor= [UIColorblackColor]; titleLabel.font= [UIFontsystemFontOfSize:14];UIButton*moreBtn = [[UIButtonalloc]init];self.moreBtn= moreBtn; [selfaddSubview:moreBtn]; [moreBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.centerY.mas_equalTo(self.bgView); make.width.mas_equalTo(60); }]; [moreBtn setImage:[UIImageimageNamed:@"btn_skip_pressed"] forState:UIControlStateNormal]; [moreBtn setTitle:@"更多"forState:UIControlStateNormal]; moreBtn.titleLabel.font= [UIFontsystemFontOfSize:12]; [moreBtn setTitleColor:[UIColorcolorWithRed:170/255.0green:170/255.0blue:170/255.0alpha:1.0] forState:UIControlStateNormal]; moreBtn.imageEdgeInsets=UIEdgeInsetsMake(0,50,0,0);}

collectionView 尾部
同样继承UICollectionReusableView的视图,就是一个灰色的view
- (instancetype)initWithFrame:(CGRect)frame{if(self= [superinitWithFrame:frame]) { [selfsetupSubviews]; }returnself;}- (void)setupSubviews{UIView*view = [[UIViewalloc]init];self.view= view; [selfaddSubview:view]; [view mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.bottom.right.mas_equalTo(0); }]; view.backgroundColor= [[UIColorlightGrayColor]colorWithAlphaComponent:0.3];}

collectionViewCell
这个就是collectionViewCell了,里面有2种尺寸的cell,根据section区分尺寸就可以了,标题也一样区分
颜值模块直播实现

直播
直播的框架,我使用的b站的ijkplayer,详细的集成方法和使用方法简书上搜一下很多,点赞,送礼物暂时没实现,待研究。
其它模块直播实现
斗鱼直播链接抓不到(加密了)所以找了一个在线直播卫视,rtmp://live.hkstv.hk.lxdns.com:1935/live/hks,只演示播放功能的实现

播放器
首页 游戏

首页 游戏
和推荐模块相近,代码类似

首页 娱乐
和推荐模块相近,代码类似

首页 趣玩
和推荐模块相近,代码类似
关注

关注

头部
这个就是加一个白色的view
- (void)setupSubviews{UIView*bgView = [[UIViewalloc]init];self.bgView= bgView; [self.viewaddSubview:bgView]; [bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo([UIScreenmainScreen].bounds.size.width); make.height.mas_equalTo(100); make.top.mas_equalTo(64); }]; bgView.backgroundColor= [UIColorwhiteColor];UILabel*label = [[UILabelalloc]init];self.label= label; [bgView addSubview:label]; [label mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(30); make.centerX.mas_equalTo(self.view); }]; label.text=@"你还没有登录"; label.font= [UIFontsystemFontOfSize:16]; label.textColor= [UIColorcolorWithRed:255/255.0green:114/255.0blue:47/255.0alpha:1.0];UILabel*subLabel = [[UILabelalloc]init]; [bgView addSubview:subLabel]; [subLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.label.mas_bottom).mas_equalTo(10); make.centerX.mas_equalTo(self.view); }]; subLabel.text=@"看看下面的推荐或登录已有帐号"; subLabel.font= [UIFontsystemFontOfSize:14]; subLabel.textColor= [UIColorgrayColor];}
我的

我的

头部
头部用的是xib,省去写代码了有弧度的控件,设置相关的layer属性,导航栏透明看代码
-(void)viewWillAppear:(BOOL)animated{ [superviewWillAppear:animated]; [self.navigationController.navigationBarsetBackgroundImage:[UIImagenew] forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBarsetShadowImage:[UIImagenew]];}-(void)viewWillDisappear:(BOOL)animated{ [superviewWillDisappear:animated]; [self.navigationController.navigationBarsetBackgroundImage:nilforBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBarsetShadowImage:nil];}
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
11
×
喜欢的用户
ANStevent2016.12.12 17:09
冯惜君2016.12.01 17:02

静等風来那个梦2016.11.05 12:09
Phone子2016.09.18 10:55
ios码农学生2016.09.11 23:12

Dev_LiYang2016.09.11 23:09

jeremywangze2016.09.11 15:52

linleiqin2016.09.11 01:06
YungFan2016.09.10 10:43

zero0002016.09.04 22:55

某某某某人2016.09.02 20:02

2 楼 ·2016.09.01 16:56
@葱花饼交流一下 婚礼纪 的电子请帖的制作 和 结婚运算这个界面的制作。谢谢 !

3 楼 ·2016.09.05 14:48
有源码吗?
5 楼 ·2016.09.09 16:53
厉害

6 楼 ·2016.09.11 10:19
能不能看一下你的源码?
7 楼 ·2016.09.12 15:50
楼主,有源码吗?

8 楼 ·2016.09.18 14:34
真厉害

9 楼 ·2016.09.18 14:34
已关注!
10 楼 ·2016.09.28 07:03
楼主为何不提供源码???
11 楼 ·2016.12.12 00:29
兄弟,我在等你信息
Ctrl+Enter 发表
被以下专题收入,发现更多相似内容:
简介 纪录开发的点点滴滴,相互学习,共同进步~ 专题内容主要包括Object-C、Swift等开发技巧以及学习过程的内容 投稿需...
2734篇文章· 2318人关注
为了让更多的人体验编程的快乐,不管您是大牛还是牛犊,欢迎您投稿,让我们建立一个资源库,根据投稿的相对质量,我们会给您一定的打赏
1567篇文章· 359人關注
学习
1134篇文章· 195人关注