NOTES

hardworking

  • Home
  • Categories
  • Archives
  • Tags
  • About

iOS开源项目收集

Posted on 2016-04-20 | In iOS | Visitors

平时自己使用或者看过的iOS代码,收集于此,于己于人方便.项目会先在github更新,之后迁移到github.io 上其他项目总结

  • TimLiu-iOS github iOS排行榜
  • open-source-library-tags 佳宾同学自己项目总结
  • SwiftGuide Swift 开源项目精选
  • Github-iOS备忘 分类、折叠查看 开源项目总结

UI部分

下拉刷新:

- [MJRefresh](https://github.com/CoderMJLee/MJRefresh#上拉刷新07-自动回弹的上拉01) 国内人开发,看文档先列出来几点 - 自定义程度高(文字,动图,heade、footer 等等) - 易使用 - 中文文档,目前已经 4000 多 star - [SVPullToRefresh](https://github.com/samvermette/SVPullToRefresh) 应该算本人使用比较早的一个下拉,上拉刷新,api 较少,使用方便

音视频播放:

  • KRVideoPlayer
    类似Weico的播放器,支持竖屏模式下全屏播放。支持 pod 安装使用

    1
    pod search KRVideoPlayer

    使用MPMoviePlayer进行视频播放,自定义控制层 来控制视频的暂定,播放,前进后退等等

    示例图片

    Read more »

Blog

Posted on 2016-03-20 | In iOS | Visitors

架构设计

博客中谈了较多架构层的干货,可以关注下

  • iOS应用架构谈 开篇
  • iOS应用架构谈 view层的组织和调用方案
  • iOS应用架构谈 网络层设计方案
  • iOS应用架构谈 本地持久化方案及动态部署

iOS大型项目开发漫谈 cp 个人见解总会有很多地方值得看

iOS 保持界面流畅的技巧专业的界面调优下面简单列几条概要:

  • CPU 资源消耗原因和解决方案 (分析)
  • GPU 资源消耗原因和解决方案 (分析)
  • AsyncDisplayKit (解决方案)
  • 微博 Demo 性能优化技巧 (示例讲解)

干货

伽蓝之堂
干货之多,受益无穷。大量自己实践总结,优秀国际技术翻译引进。举例:

  • iOS 保持界面流畅的技巧
  • 深入理解RunLoop
  • 颜色模型

pieces colloction

Posted on 2016-03-01 | In iOS | Visitors
  • formatter设置: [formatter stringFromDate:date]

1
2
3
4
5
NSDate *date = _datePicker.date;
NSDateFormatter *formatter = [NSDateFormatter new];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSString *tempStr = [formatter stringFromDate:date];
//2014-05-06 16:22:22 -> yyyy-MM-dd HH:mm:ss
  • appearance 全局布局以及attributes设置navigationBar

1
2
3
4
5
6
7
//BarTintcolor
[[UINavigationBar appearance]setBarTintColor:[UIColor orangeColor]];
[[UINavigationBar appearance]setTranslucent:NO];
[UIView appearance].backgroundColor = [UIColor whiteColor];
[[UINavigationBar appearance]setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorFromHexCode:@"534530"],NSFontAttributeName:[UIFont systemFontOfSize:22]}];
[[UITableView appearance]setSeparatorColor:[UIColor colorFromHexCode:@"9c896f"]];
[[UIBarButtonItem appearance]setTintColor:[UIColor colorFromHexCode:@"726754"]];
1
2
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil];
[nav.navigationBar setTitleTextAttributes:attributes];
Read more »

tableViewCell、collectionViewCell

Posted on 2016-02-14 | In iOS | Visitors

目录

  • 注册重用法
  • tableview自适应高度
  • tableview撤销高亮
  • 参数的传递
    1. 纯代码(didselectRow)
    2. storyBoard方式(prepareForSegue)

tableViewCell、collectionViewCell重用注册法

  1. 纯代码注册时用registerClass如下图示例
  2. xib界面注册时用registerNib作(tableView或collectionView)的cell
  3. storyboard
  • 注册方法

1
2
3
4
5
6
[self.myCollectionView registerClass:[MycollectionViewCell class]
forCellWithReuseIdentifier:@"cell"];
[self.myCollectionView registerNib:[UINib nibWithNibName:@"mycollectionCell"
bundle:nil]
forCellWithReuseIdentifier:cellIndentify];
Read more »

file system

Posted on 2016-02-14 | In iOS | Visitors

ios的文件管理有1.属性列表2.归档3.数据库(SQLite)4.coreData4种方式

属性列表Plist

IPA的存储空间

沙盒 Sandbox :读可写

1
NSString *docPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;

应用程序文件 Bundle :只读

1
NSString *settingPath = [[NSBundle mainBundle] pathForResource:@"Setting" ofType:@"plist"];

手动创建plist文件

info.Plist

系统plist文件

通过对应的key获取info.plist中的信息

如版本号versio

1
2
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *versionNumber = infoDic[versionKey];
Read more »

网络请求

Posted on 2016-02-13 | In iOS | Visitors

工作流程(AFNetworking)

环境配置

工作模式

创建一个NSURLSessionConfiguration,用于第二步创建NSSession时设置工作模式和网络设置:

网络设置

创建一个NSURLSession,系统提供了两个创建方法:

task

创建一个NSURLRequest调用刚才的NSURLSession对象提供的Task函数,创建一个NSURLSessionTask。
根据职能不同Task有三种子类:
NSURLSessionUploadTask:上传用的Task,传完以后不会再下载返回结果;
NSURLSessionDownloadTask:下载用的Task;
NSURLSessionDataTask:可以上传内容,上传完成后再进行下载。

Read more »

Thread

Posted on 2016-02-12 | In iOS | Visitors

多线程的实现方式

1.pThread:最早期,纯c,兼容所有c语言基础的代码
2.NSThread:本质上是使用oc对pThread的一个封装,是早期iOS使用的多线程
3.GCD:使用C语法+block语法,目前为止,苹果主推的多线程技术,功能强大,效率高
4.NSOperation:使用oc对GCD的封装,在GCD基础上额外增加了几个特性,不过效率没有GCD高,通常在不使用这些特性时,依然选择GCD

Read more »

UISearch

Posted on 2016-02-10 | Visitors

iOS8之前

1
wait to add

iOS8之后

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@interface ViewController ()<UISearchResultsUpdating,UISearchBarDelegate>
@property(nonatomic) UISearchController *searchC;
- (UISearchController *)searchC{
if (!_searchC) {
_searchC = [[UISearchController alloc]initWithSearchResultsController:[TableViewController new]];
_searchC.searchBar.scopeButtonTitles = @[@"Device",@"Soft",@"Other"];
//设置搜索结果发生变化时,代理由谁负责
_searchC.searchResultsUpdater = self;
#warning 应对scope变化时的无法监听的问题
_searchC.searchBar.delegate = self;
}
return _searchC;
}
#warning 应对scope变化时的无法监听的问题
#pragma mark - UISearchBar Delegate
-(void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope{
[self updateSearchResultsForSearchController:self.searchC];
}
#warning 实际上scope选项变化时并没有触发
-(void)updateSearchResultsForSearchController:(UISearchController *)searchController{
NSString *text = searchController.searchBar.text;
NSInteger selectedIndex = searchController.searchBar.selectedScopeButtonIndex;
NSMutableArray *tmpArr = [NSMutableArray new];
for (Product *p in self.dataList) {
if ([p.name containsString:text] && p.type == selectedIndex) {
[tmpArr addObject:p];
}
}
TableViewController *vc = (TableViewController *)searchController.searchResultsController;
vc.resultArr = tmpArr;
}

test

Posted on 2016-02-09 | Visitors

一到家就各种出问题哦,哎哎哎,咋回事呢!咋回事呢!

123
JunChuan Shi

JunChuan Shi

学习,生活,记点杂七杂八的东西

27 posts
2 categories
16 tags
RSS
GitHub Weibo Twitter
links
  • rencheng
© 2015 - 2018 JunChuan Shi