学习总结

2018-01-18  本文已影响150人  有毒的程序猿

前言

那年我在缅甸, 因为赌石,我把护照都压上了, 结果还是输了, 赌石的地方在缅甸的诺瓦达卡存, 无奈之下我决定挺而走险, 越境回国, 可惜被缅甸边防军发现了, 并向我开枪射击,我左脚中枪,一瘸一拐的奔着祖国的方向一步一步的挪,左脚的疼痛让我难以忍受,当时身边我有很多树木,我都没有扶, 我就服你作者,真能扯.

学习总结.jpeg
一、网络方面
// 主要是听老师讲了断点的下载,并且自己封装了一个用起来很好的库.
  1. 下载数据时避免IO频繁操作应该用文件流.

  2. _outputStream = [[NSOutputStream alloc]initToFileAtPath:@""append:YES];
    append 为YES时是启动文件流写入时是否拼接数据.

  3. 利用NSOperation封装了请求的并发队列,并加入缓存机制.

二、数据库存储方面
  1. 重新熟悉了一下sql语句的拼写.
建表: CREATE TABLE IF NOT EXISTS tableName (char id,chat name)

插入: INSERT INTO  tableName values('1','有毒的程序猿');

查询: select *from tableName where id+0 > 2 and name like '%有毒%' 
order by id+0 limit 20;

更新: update tableName set  name = '程序' where id = '1';

删除: delete from tableName where id = '1';

修改表: alter table  tableName add column age char default '20';

删表: drop table tableName;

2.sqlite3的一些使用.

创建数据库文件:sqlite3_open_v2();

检测sql语句:sqlite3_prepare_v2();

执行指令:sqlite3_step();

结束:sqlite3_finalize();

3.看了看FMDB源码

知道了事务
@"begin exclusive transaction"// 开始事务
@"rollback transaction"            //  回滚事务
@"commit transaction"            //   提交事务
FMDB 在一个同步线程实现了串行.
三、动画方面
  1. 自定制presentdismiss动画
控制器实现两个代理:

//  present
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented 
presentingController:(UIViewController *)presenting 
sourceController:(UIViewController *)source;

// dismiss
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed;

注: 以上两个代理发挥自定制动画.

自定制动画实现:
遵循<UIViewControllerAnimatedTransitioning>议类
- (NSTimeInterval)transitionDuration:(nullable id <UIViewControllerContextTransitioning>)transitionContext;
- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext;


  1. 非交互式动画
- (nullable id <UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)animator;

可继承系统类UIPercentDrivenInteractiveTransition来返回(nullable id <UIViewControllerInteractiveTransitioning>)对象.
在这个对象里面可以添加手势, 自定义动画.

上一篇 下一篇

猜你喜欢

热点阅读