1.自定义UITabBar

 #import <UIKit/UIKit.h>

 @interface XHQTabBarViewController : UITabBarController
@property(nonatomic,strong) NSMutableArray * controllers
; //@tip 创建tabbaritem
//@para title tabbaritem标题
// normal 正常情况下tabbaritem图片
// selectedImage 选中情况下tabbaritem图片
// controllerName tabbaritem所对应的的控制器
//@result 无
-(void) addItem:(NSString*)title normalImage:(UIImage*)normal highLightImage:(UIImage*)selectedImage controller:(NSString*)controllerName ;
 #import "XHQTabBarViewController.h"

 @interface XHQTabBarViewController ()

 @end

 @implementation XHQTabBarViewController

 //初始化
-(instancetype)init{
if (self=[super init]) {
_controllers = [[NSMutableArray alloc] init];
}
return self;
} //创建tabbaritem
-(void) addItem:(NSString*)title normalImage:(UIImage*)normal highLightImage:(UIImage*)highLight controller:(NSString*)controllerName { //创建tabBarItem
normal = [normal imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
highLight = [highLight imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UITabBarItem * item = [[UITabBarItem alloc] initWithTitle:title image:normal selectedImage:highLight];
[item setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName: [UIFont systemFontOfSize:]} forState:UIControlStateNormal]; //得到控制器类
Class controllerClass = NSClassFromString(controllerName); //创建控制器
UIViewController * controller = [[controllerClass alloc] init];
controller.navigationItem.title = title;//设置导航栏标题 //创建导航栏
UINavigationController * navigationController = [[UINavigationController alloc] initWithRootViewController:controller]; //设置item
controller.tabBarItem = item;
// controller.tabBarController.tabBar.barTintColor = ;
self.tabBar.barTintColor =[UIColor colorWithRed:121.0/ green:200.0/ blue:231.0/ alpha:]; //将控制器加入数组
[_controllers addObject:navigationController]; }
@end

2.设置cell的动画:

//给cell添加动画

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

//设置Cell的动画效果为3D效果

//设置x和y的初始值为0.1;

cell.layer.transform = CATransform3DMakeScale(0.1, 0.1, 1);

//x和y的最终值为1

[UIView animateWithDuration:1 animations:^{

cell.layer.transform = CATransform3DMakeScale(1, 1, 1);

}];

}

3.表视图设置索引:

 - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
NSArray *array = @[@"A", @"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z"];
self.tableView.sectionIndexBackgroundColor = [UIColor clearColor];//背景色
self.tableView.sectionIndexColor = [UIColor blueColor];//字体色
return array;
}
 //索引点击事件
-(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { NSLog(@"点击了第%ld个",index);
return ;
}

4.UICollectionView的头尾视图设置:

 #pragma mark 设置头尾视图的大小

 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
{
return CGSizeMake(XHQ_SCRWIDTH, );
}
 #pragma mark 返回头尾视图

 - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *reusableView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"HEADER" forIndexPath:indexPath]; for(UIView *subview in reusableView.subviews)
{
[subview removeFromSuperview];
} UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(, , XHQ_SCRWIDTH, )]; XHQFoundCarSubModel *model = self.dataSource[indexPath.section]; label.text = model.name; [reusableView addSubview:label]; return reusableView; }

5.设置push动画:

//定位按钮被点击
- (void)Localself
{
XHQFoundMoreViewController *more = [[XHQFoundMoreViewController alloc]init]; //push带动画
[self pushNextWithType:@"suckEffect" Subtype:@"fromLeft" Viewcontroller:more];
}
 - (void)pushNextWithType:(NSString *)type Subtype:(NSString *)subtype Viewcontroller:(UIViewController *)viewController
{
CATransition *transition = [CATransition animation];
transition.type = type;
transition.subtype = subtype;
transition.duration = ;
viewController.hidesBottomBarWhenPushed = YES;
[self.navigationController .view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:viewController animated:nil]; }

6.封装图形的圆角设置:

 + (void)layerCornerRadius:(CALayer *)dest radius:(float)radius width:(float)width color:(UIColor *)color
{
dest.cornerRadius = radius;
dest.borderWidth = width;
dest.borderColor = color.CGColor;
dest.masksToBounds = YES;
}
类方法调用:

1 [XHQAuxiliary layerCornerRadius:self.userface.layer radius: width: color:[UIColor yellowColor]];

7.实现夜间模式的开关按钮:

 if(indexPath.row == )
{
UISwitch *swi = [[UISwitch alloc]init];
[swi addTarget:self action:@selector(changeValue:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = swi;
}

8.实现图头放大:

 #pragma mark - 实现scrollView的代理方法
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
//实现图头放大的核心思想:通过改变scrollView的偏移量来改变图片的frame
if(scrollView == self.tableView)
{
//获取scrollView的偏移量
float yOffset = scrollView.contentOffset.y; NSLog(@"yoffset = %f",yOffset); //往下拉值越来越小 //scrollView的横向偏移量是随着纵向偏移量的变化而变化
float xOffset = (yOffset + ImageOriginHeight) / ;
if (yOffset < -ImageOriginHeight) {
//改变imageView的frame
CGRect rect = _headerImageView.frame; rect.origin.y = -yOffset;
rect.size.height = -yOffset * ; rect.origin.x = xOffset;
rect.size.width = XHQ_SCRWIDTH + fabs(xOffset) * ; _headerImageView.frame = rect;
// NSLog(@"%f

AutoHome项目的学习的更多相关文章

  1. Android 开源项目及其学习

    Android 系统研究:http://blog.csdn.net/luoshengyang/article/details/8923485 Android 腾讯技术人员博客 http://hukai ...

  2. 【转】iOS超全开源框架、项目和学习资料汇总

    iOS超全开源框架.项目和学习资料汇总(1)UI篇iOS超全开源框架.项目和学习资料汇总(2)动画篇iOS超全开源框架.项目和学习资料汇总(3)网络和Model篇iOS超全开源框架.项目和学习资料汇总 ...

  3. 开源项目live555学习心得

      推荐:伊朗美女找丈夫比找工作难女人婚前一定要看清三件事 × 登录注册   疯狂少男-IT技术的博客 http://blog.sina.com.cn/crazyboyzhaolei [订阅][手机订 ...

  4. iOS超全开源框架、项目和学习资料汇总--数据库、缓存处理、图像浏览、摄像照相视频音频篇

    iOS超全开源框架.项目和学习资料汇总--数据库.缓存处理.图像浏览.摄像照相视频音频篇 感谢:Ming_en_long 的分享 大神超赞的集合,http://www.jianshu.com/p/f3 ...

  5. soul开源网关项目搭建学习

    1. soul开源网关项目搭建学习 1.1. 地址 https://gitee.com/shuaiqiyu/soul 1.2. 介绍 官方介绍:这是一个异步的,高性能的,跨语言的,响应式的API网关. ...

  6. 一个比较全面 的web项目实战学习

    一个比较全面 的web项目实战学习:http://www.cnblogs.com/jikey/p/3613082.html

  7. 一个toolkit或者一个开源项目如何学习它并使用它

    一个toolkit或者一个开源项目如何学习它并使用它 一般一个流行的toolkit和开源项目,一般都会被广泛地被应用: 那么,我们如何学习它,如何应用它在自己的业务场景中呢? 答案就是:学习源码并借鉴 ...

  8. 《Java 程序设计》课堂实践项目 课后学习总结

    <Java 程序设计>课堂实践项目 课后学习总结 String类的使用(sort) 目录 Linux命令(sort) 课堂实践 课后思考 学习老师的代码之后的思考:int与Integer ...

  9. iOS超全开源框架、项目和学习资料汇总(5)AppleWatch、经典博客、三方开源总结篇

    完整项目 v2ex – v2ex 的客户端,新闻.论坛.apps-ios-wikipedia – apps-ios-wikipedia 客户端.jetstream-ios – 一款 Uber 的 MV ...

随机推荐

  1. 【16】大调 Leading Bass

    一小节2拍: (歌曲举例子) 菊花台(主).知足(主).青春修炼手册(副).记得(副).当你(副). 一小节1拍: (歌曲举例子) 菊花台(主).知足(主).青春修炼手册(副).记得(副).当你(副) ...

  2. Ubuntu系统---“NVIDIA 驱动+CUDA+cuDNN ”之后 OpenCV安装

    Ubuntu系统---“NVIDIA 驱动+CUDA+cuDNN ”之后 OpenCV安装 目录: 一.OpenCV安装包下载 二.cmake安装 三.OpenCV安装 正文 一.OpenCV安装包下 ...

  3. 说一下 runnable 和 callable 有什么区别?(未完成)

    说一下 runnable 和 callable 有什么区别?(未完成)

  4. python_面向对象——类之间的依赖关系

    class Dog: def __init__(self,name,age,master): self.name = name self.age = age self.master = master ...

  5. Linux C打印所有的环境变量

    #include <stdio.h> extern char** environ; int main() { ; ; environ[nIndex] != NULL; nIndex++) ...

  6. mapbox展示动态图标

    mapbox-gl通过为marker设置css动画,实现动态闪烁效果,先放个效果图 . 1.主要就是为元素设置一个动画, myfirst动画让元素随时间放大 .marker { /* backgrou ...

  7. js访问数据库

    一.js访问数据库的一般步骤: 1. 创建一个到数据库的 ADO 连接 conn = new ActiveXObject("ADODB.Connection"); 2. 打开数据库 ...

  8. 【概率论】3-6:条件分布(Conditional Distributions Part I)

    title: [概率论]3-6:条件分布(Conditional Distributions Part I) categories: Mathematic Probability keywords: ...

  9. 一行代码加快pandas计算速度

    一行代码加快pandas计算速度 DASK https://blog.csdn.net/sinat_38682860/article/details/84844964 https://cloud.te ...

  10. (转)实验文档3:在kubernetes集群里集成Apollo配置中心

    使用ConfigMap管理应用配置 拆分环境 主机名 角色 ip HDSS7-11.host.com zk1.od.com(Test环境) 10.4.7.11 HDSS7-12.host.com zk ...