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. SPFA的优化

    [为什么要优化] 关于SPFA,他死了(懂的都懂)   进入正题... 一般来说,我们有三种优化方法. SLF优化: SLF优化,即 Small Label First  策略,使用 双端队列 进行优 ...

  2. Vuex的mapGetters方法使用报错

    报错信息: ERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script ...

  3. solr query没有反应,地址报错查询的地址error

    随便修改了一下angular.js,保存,再修改,就可以查询了 问题应该是对文件没有操作权限.感觉solr在部署时对文件的授权还是很重要的

  4. mybatis+mysql批量插入和批量更新

    一.批量插入 批量插入数据使用的sql语句是: insert into table (字段一,字段二,字段三) values(xx,xx,xx),(oo,oo,oo) mybatis中mapper.x ...

  5. 调整swt table的行高

    table.addListener(SWT.MeasureItem, new Listener() { public void handleEvent(Event event) { // 设置行高度 ...

  6. [2019HDU多校第五场][HDU 6626][C. geometric problem]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6626 题目大意:给出平面上六个点\(A,B,M,N,X,Y\)以及两条直线\(L1,L2\),要求在四 ...

  7. SIGAI机器学习第七集 k近邻算法

    讲授K近邻思想,kNN的预测算法,距离函数,距离度量学习,kNN算法的实际应用. KNN是有监督机器学习算法,K-means是一个聚类算法,都依赖于距离函数.没有训练过程,只有预测过程. 大纲: k近 ...

  8. 006_FreeRTOS其他API函数

    (一)FreeRTOS其他API函数是在调试中使用的,具体使用的看书本,贴出来为了方便查找 (二)FreeRTOS其他API函数 (三)常用 1. uxTaskGetSystemState() 获取信 ...

  9. linux中 systemd相关配置

    systemd相关配置 推荐使用systemd管理进程,相比使用supervisord systemd提供系统级别的支援. 一.系统管理 Systemd 并不是一个命令,而是一组命令,涉及到系统管理的 ...

  10. python3安装web.py

    今天准备测试代理池IPProxyPool获取到ip的质量,在安装web.py的时候遇到了些问题,在此记录一下. 1.安装资料 web.py官网:http://webpy.org/ web.py的git ...