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. uni-app之tabBar的自己配置

    1.因为产品相关的的权限,需要配置不同的导航,这时候需要自定义导航.分离出来的就是一个小的组件.(tabBar.vue) 此处暂时用的html插入的代码,能粘贴到vue文件即可. <templa ...

  2. sql prompt工具

    SQL Prompt是一款拥有SQL智能提示功能和格式化Sql代码插件.可用于的SQL Server和VS. SQL Prompt能根据数据库的对象名称,语法和用户编写的代码片段自动进行检索,智能的为 ...

  3. JS window对象详解

    window 是客户端浏览器对象模型的基类,window 对象是客户端 JavaScript 的全局对象.一个 window 对象实际上就是一个独立的窗口,对于框架页面来说,浏览器窗口每个框架都包含一 ...

  4. JVM系列-001-JVM监控工具

    JVM系列-001-JVM监控工具 在我们安装的jdk里面的bin目录下有一个jconsole.exe程序.这就是一个JVM的监控工具.我们可以直接打开它,如果配置了环境变量,也可以在命令中直接输入j ...

  5. 一步一步学会preload和prefetch

    preload和prefetch是什么? 我们常说的preload和prefetch,是link标签rel里新增的两种值,用于让浏览器提前加载指定的资源,它们会先被缓存(属于http cache缓存) ...

  6. How to find First Non-Repeated Character from String

    You need to write a function, which will accept a String and return first non-repeated character, fo ...

  7. Java 加解密算法

    目前加密算法中分两种 一种是对称加密,一种是非对称加密 那么什么是对称加密呢?对称加密可以理解为加密和解密用的是一个钥匙. 而非对称加密,加锁用的是一个钥匙,而解锁用的是另外一个钥匙. 目前市面上用的 ...

  8. python django 连接 sql-server

    1.准备工作 python3.6连接sqlserver数据库需要引入pymssql模块 pymssql官方:https://pypi.org/project/pymssql/ 没有安装的话需要: pi ...

  9. Vue2 响应式原理

    我们经常用vue的双向绑定,改变data的某个属性值,vue就马上帮我们自动更新视图,下面我们看看原理. Object的响应式原理: 可以看到,其实核心就是把object的所有属性都加上getter. ...

  10. NSArray 的创建和遍历

    数组 用来存贮对象的有序列表,它是不可变的 不能存数C语言的基本数据类型 只支持OC对象 #pragma mark Create a array //Initialize NSArray void a ...