QQ空间HD(5)-添加左侧菜单栏内容
DJIconView.m
#import "DJIconView.h"
@implementation DJIconView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// self.backgroundColor = [UIColor redColor];
self.imageView.layer.cornerRadius = ;
[self setImage:[UIImage imageNamed:@"yongdaimi"] forState:UIControlStateNormal];
[self setTitle:@"yongdaimi" forState:UIControlStateNormal];
[self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.titleLabel.font = [UIFont systemFontOfSize:];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
if (DJLandscape) { // 横屏
/* imageView */
self.imageView.width = self.width;
self.imageView.height = self.imageView.width;
self.imageView.x = ;
self.imageView.y = ;
/* titleLabel */
self.titleLabel.hidden = NO;
self.titleLabel.width = self.width;
self.titleLabel.height = ;
self.titleLabel.x = ;
self.titleLabel.y = self.imageView.height;
} else { // 竖屏
/*imageView*/
self.imageView.width = self.width;
self.imageView.height = self.imageView.width;
self.imageView.x = ;
self.imageView.y = ;
/*titleLabel*/
self.titleLabel.hidden = YES;
}
}
@end
DJTabBar.m
#import "DJTabBar.h"
@implementation DJTabBar
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// self.backgroundColor = [UIColor greenColor];
[self setupBtnImage:@"tab_bar_feed_icon" title:@"全部动态"];
[self setupBtnImage:@"tab_bar_passive_feed_icon" title:@"与我相关"];
[self setupBtnImage:@"tab_bar_pic_wall_icon" title:@"照片樯"];
[self setupBtnImage:@"tab_bar_e_album_icon" title:@"电子相框"];
[self setupBtnImage:@"tab_bar_friend_icon" title:@"好友"];
[self setupBtnImage:@"tab_bar_e_more_icon" title:@"更多"];
}
return self;
}
- (void)setupBtnImage:(NSString *)imageName title:(NSString *)title {
UIButton *btn = [[UIButton alloc] init];
// 设置按钮内容左对齐
btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
// 设置左填充
btn.contentEdgeInsets = UIEdgeInsetsMake(, , , );
[btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
btn.titleEdgeInsets = UIEdgeInsetsMake(, , , );
[btn setTitle:title forState:UIControlStateNormal];
[btn setBackgroundImage:[UIImage imageNamed:@"tabbar_separate_selected_bg"] forState:UIControlStateDisabled];
[self addSubview:btn];
}
- (void)layoutSubviews {
[super layoutSubviews];
NSUInteger count = self.subviews.count;
if (DJLandscape) { // 横屏
for (int i = ; i < count; i++) {
UIButton *btn = self.subviews[i];
btn.width = self.width;
btn.height = self.width / ;
btn.x = ;
btn.y = i * btn.height;
}
} else {
for (int i = ; i < count; i++) {
UIButton *btn = self.subviews[i];
btn.width = self.width;
btn.height = btn.width;
btn.x = ;
btn.y = i * btn.height;
}
}
}
@end
QzoneHD.pch
// 横屏
#define DJLandscape ([UIScreen mainScreen].bounds.size.width == 1024)
// 竖屏
#define DJPortrait ([UIScreen mainScreen].bounds.size.width == 768)
最终效果:
横屏:

竖屏:

QQ空间HD(5)-添加左侧菜单栏内容的更多相关文章
- QQ空间HD(4)-设置左侧菜单栏属性
DJHomeViewController.m #import "DJHomeViewController.h" #import "DJMenuView.h" ; ...
- QQ空间HD(6)-实现自定义的选项卡切换效果
DJTabbarButton.m #import "DJTabbarButton.h" @implementation DJTabbarButton - (instancetype ...
- QQ空间HD(1)-UIPopoverController基本使用
UIPopoverController 是iPad的专属API ViewController.m #import "ViewController.h" #import " ...
- QQ空间HD(3)-Modal的切换效果总结
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { UIViewController ...
- QQ空间HD(2)-UIPopoverController其它使用
DJTestViewController.m #import "DJTestViewController.h" #import "DJColorTableViewCont ...
- Android项目实战(十六):QQ空间实现(一)—— 展示说说中的评论内容并有相应点击事件
大家都玩QQ空间客户端,对于每一个说说,我们都可以评论,那么,对于某一条评论: 白雪公主 回复 小矮人 : 你们好啊~ 我们来分析一下: .QQ空间允许我们 点击 回复人和被回复人的名字就可以进入对于 ...
- 分享内容到微博、QQ空间、人人网、开心网等社区
网上有不少分享内容到微博.QQ空间.人人网.开心网等社区的插件,但它们都有自己固定的样式,你不一定会喜欢. 或许你想保持你的网站的原状,添加上微博.QQ空间.人人网.开心网的LOGO图片,点击之后就可 ...
- QQ空间添加背景音乐
QQ空间背景音乐方式 1.QQ音乐添加背景音乐一种是开通绿砖[有矿的忽略此条]2.QQ空间添加网络音乐的方法步骤:1.首先,需要先下载好想要音乐作为QQ空间背景音乐的歌曲文件(建议为MP3格式)[我这 ...
- QQ空间动态内容,好友信息,点赞爬虫脚本
一.安装基础的软件包: 1.准备好火狐浏览器,并下载geckodriver,将geckodriver加入到环境变量:下载geckodriver的地址:https://pan.baidu.com/s/1 ...
随机推荐
- Oracle11g的最佳灵活体系结构OFA
- Linux下磁盘挂载
公司硬盘不够用了,新买了一个存储,需要挂载到现在的系统上.前期的步骤就不说了,运维全部搞定,无非是硬件和网络那一套,这里只说分配到本人后在Linux下如何挂载. 具体步骤如下: 1.查看是否已经分配 ...
- POJ1717 Dominoes[背包DP]
Dominoes Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6731 Accepted: 2234 Descript ...
- org.hibernate.HibernateException: No Session found for current thread
spring.springmvc和hibernate整合 在sessionFactory.getCurrentSession()时,出现以下异常 No Session found for curren ...
- 转: Protobuf 的 proto3 与 proto2 的区别
Protobuf 的 proto3 与 proto2 的区别 On 2015-07-17 19:16:00 By Soli Protobuf 的 proto3 与 proto2 的区别 这是一 ...
- C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 数据权限增强、范围权限增强
并不是不想做B\S的管理工具,只是精力实在不够,由于用户权限管理组件是基础组件.所以C\S的也无妨,不会有几个人在乎Oracle,SQLServer是否不b\s的,注重的是功能性能,请大家不要纠结与是 ...
- javaScript 中的布尔运算符 && 和 ||
布尔运算符 && 和 ||的返回结果不一定是布尔值!由此来展开一定的研究及理解. 1.首先先介绍下常见的数据类型转化为bool后的值. (常用地方)在if表达式中,javascript ...
- ffmbc——广播电视以及专业用途量身定制的FFmpeg
做项目遇到针对于mpegts多节目流转码的问题,看遍了ffmpeg的参数都得不到解决办法,最后在雷神的博客中看到了ffmbc: 结果,还是没解决问题,但是看起来改改ffmbc的代码还是相对简单一些,抽 ...
- DayPilot 7.8 DLL去DEMO字样下载
来自 DayPilot 的 7.8.3169.1 版本的DLL,微调去掉了“DEMO”字样,供参考,商用请支持正版! 此处下载: http://files.cnblogs.com/files/pcca ...
- iOS学习-KVO设计模式
KVO 即Key-Value Observing 键-值观察的缩写,简单的说就是通过键来观察一个对象属性值的变化.当这个被观察的属性发生变化时,观察者就会收到通知(观察者可以是这个对象本身,也可以是 ...