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. 从c到c++<一>

    逻辑型也称布尔型,其取值为true(逻辑真)和false(逻辑假),存储字节数在不同编译系统中可能有所不同,VC++中为1个字节. 声明方式: bool result; result=true; 可以 ...

  2. win服务器 解决apache 80端口被占用问题

    是系统的服务占用了80端口,所以要么结束系统服务,要么修改apache端口. PID4的服务是World Wide Web Publishing Service 这里选择结束这个系统服务,运行serv ...

  3. Pytest【定制fixture】

    在pytest中的fixture是在测试函数运行前后,由pytest执行的外壳函数,fixture中的代码可以定制,满足多变的测试需求:包括定义传入测试中的数据集.配置测试前系统的初始化状态.为批量测 ...

  4. [唐胡璐]Selenium技巧 - 处理Windows程序(进程)

    Selenium WebDriver java 提供了一个专门的WindowsUtils类去和Windows操作系统交互。 就像我们之前说过有时候跑完脚本后,IEDriverServer.exe进程没 ...

  5. [唐胡璐]Selenium技巧- Prop.Properties配置测试应用的环境和其他配置项

     prop.propertiesfile contains important info that needs to be changed before the test is run, such a ...

  6. Spring注解详解(转)

    概述 注释配置相对于 XML 配置具有很多的优势: 它可以充分利用 Java 的反射机制获取类结构信息,这些信息可以有效减少配置的工作.如使用 JPA 注释配置 ORM 映射时,我们就不需要指定 PO ...

  7. springboot2.0入门(六)-- ymal语法、数据校验

    一.基本使用 1.ymal语法是一种更符合人类命名习惯的语法: # 1. 一个家庭有爸爸.妈妈.孩子. # 2. 这个家庭有一个名字(family-name)叫做“happy family” # 3. ...

  8. SQL Server Report Server

    1.SQL Server Report Server是利用mircosoft的share point产品 在menu 打开Reporting Services Configuration进行配置,会自 ...

  9. PC端使用program來CHGUSRPRF

    執行CHGUSRPRF命令需要*SECADM 權限,但通常Security部門不允許Grant這個這麼大的權限,爲了達到目的,改用下面的方法 1. Create CL program 注意裏面一定要用 ...

  10. Bzoj 3036: 绿豆蛙的归宿(期望)

    3036: 绿豆蛙的归宿 Time Limit: 2 Sec Memory Limit: 128 MB Description 随着新版百度空间的下线,Blog宠物绿豆蛙完成了它的使命,去寻找它新的归 ...