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. 为什么要用BigDecimal

    一般货币计算的时候都要用到BigDecimal类,为什么一般不适用float或者double呢? 先看一下浮点数的二进制表示: 小数 0.125 0.125 * 2 = 0.25 0 0.25 * 2 ...

  2. vim 操作命令大全

     转子:https://www.cnblogs.com/yangjig/p/6014198.html 和 https://blog.csdn.net/u010956473/article/detail ...

  3. SP116 INTERVAL - Intervals

    题意翻译 区间取数 题目描述 有n个区间,在区间[ai,bi]中至少取任意互不相同的ci个整数.求在满足n个区间的情况下,至少要取多少个正整数. 输入输出格式 输入格式 多组数据. 第一行的一个整数T ...

  4. Mysql 随机获得表的几条记录

    在做博客文章详情的时候,有一个拓展阅读的功能: 想法一:根据当前文章Id,写死两条链接,Id+1,Id-1,但是文章Id可能被删除,Id不连续,不可取.× 想法二:获得当前文章记录的前一条和后一条记录 ...

  5. Strategic game POJ - 1463 【最小点覆盖集】

    Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solu ...

  6. 012_STM32程序移植之_内部flash开机次数管理lib库建立

    012_STM32程序移植之_内部flash开机次数管理lib库建立 1. 测试环境:STM32C8T6 2. 测试接口: 3. 串口使用串口一,波特率9600 单片机引脚------------CH ...

  7. [Number]js中数字存储(0.1 + 0.2 !== 0.3)

    和其他编程语言(如 C 和 Java)不同,JavaScript 不区分整数值和浮点数值, 所有数字在 JavaScript 中均用浮点数值表示,遵循IEEE754标准,在进行数字运算的时候要特别注意 ...

  8. MySQL 一次非常有意思的SQL优化经历:从30248.271s到0.001s

    转载自:https://www.toutiao.com/i6668275333034148356 一.背景介绍 用的数据库是mysql5.6,下面简单的介绍下场景 课程表: 数据100条 学生表: 数 ...

  9. 微信小程序之 map 地图使用

    1.在app.json中与pages平级的位置处,加上: "permission": { "scope.userLocation": { "desc& ...

  10. 应用webservice实现公网天气查询

    1. wsdl网址:http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl 2. URL:http://www.webxml.com.cn/zh ...