语法 - 随机数生成实现
变更记录
序号
录入时间
录入人
备注
1
2015-03-26
Alfred Jiang
-
2
2015-12-23
Alfred Jiang
-
方案名称语法 - 随机数生成实现
关键字语法 \ 随机ID \ 随机字符串 \ 随机数
需求场景
测试随机结果的场景需求
参考链接
CSDN - ios 生成不重复随机数
详细内容iOS 有如下三种随机数方法:
12345678910//1.srand((unsigned)time(0)); //不加这句每次产生的随机数不变int i = rand() % 5;//2.srandom(time(0));int i = random() % 5;//3.int i = arc4random() % 5 ;
注:rand() 和 random() 实际并不是一个真正的伪随机数发生器,在使用之前需要先初始化随机种子,否则每次生成的随机数一样。
arc4random() 是一个真正的伪随机算法,不需要生成随机种子,因为第一次调用的时候就会自动生成。而且范围是 rand() 的两倍。在 iPhone 中, RAND_MA ...
NSString - 汉字繁体简体相互转换的实现
变更记录
序号
录入时间
录入人
备注
1
2015-03-26
Alfred Jiang
录入
2
2015-08-18
Alfred Jiang
更新
3
2015-12-23
Alfred Jiang
-
方案名称NSString - 汉字繁体简体相互转换的实现
关键字NSString \ 简体汉字 \ 繁体汉字 \ 繁简转换
需求场景
需要对本地工程显示文字进行繁体和简体互相转换时
参考链接
GitHub - OBCConvertor
GitHub - ChineseToPinYin
详细内容#####1. convertGB_BIG
需要添加 big5.txt 和 gb.txt 文件
convertGB_BIG.h
12345678910111213141516171819202122232425262728293031323334353637383940414243444546//// convertGB_BIG.h// myTest//// Created by sffofn on 11-8-17.// Copyright 2011 k ...
NSString - 汉字转为拼音显示的实现
变更记录
序号
录入时间
录入人
备注
1
2015-03-26
Alfred Jiang
-
2
2015-12-23
Alfred Jiang
-
方案名称NSString - 汉字转为拼音显示的实现
关键字NSString \ 汉字 \ 拼音 \ 转换
需求场景
需要将汉字转为英文拼音的场景
参考链接
Code4App - 汉字转拼音
GitHub - ChineseToPinYin
GitHub - POAPinyin
详细内容通过使用苹果类库 CFStringTransform 提供的方法实现汉字转拼音。通过 kCFStringTransformMandarinLatin 把汉字转换为中国拼音。通过 kCFStringTransformStripDiacritics 把中国拼音转换为英文字母。
1234567891011121314151617- (NSString *)hanziToPinyin:(NSString *)aHanZi{ NSString *strResult = @""; if ([aHanZi ...
网络 - 判断连接状态
变更记录
序号
录入时间
录入人
备注
1
2015-03-18
Alfred Jiang
-
2
2015-12-22
Alfred Jiang
-
方案名称网络 - 判断连接状态
关键字网络 \ 网络连接 \ Network \ Connection
需求场景
需要对网络状态进行判断的场景
参考链接(无)
详细内容#####1. 导入 SystemConfiguration.framework ,并 #import<SystemConfiguration/SCNetworkReachability.h>
#####2. 判断设备是否联网
1234567891011121314151617181920212223242526272829+ (BOOL)connectedToNetwork{ //创建零地址,0.0.0.0的地址表示查询本机的网络连接状态 struct sockaddr_storage zeroAddress; bzero(&zeroAddress, sizeof(zeroAddress)); ...
数据加密 - 3DES 加密(包含JAVA服务器端解密)
变更记录
序号
录入时间
录入人
备注
1
2015-02-27
Alfred Jiang
-
2
2015-12-22
Alfred Jiang
-
方案名称数据加密 - 3DES 加密(包含JAVA服务器端解密)
关键字数据加密 \ 加密 \ 解密 \ 3DES
需求场景
移动端与服务器敏感数据通讯
移动端本地部分需要保存的敏感数据(NSUserDefaults、文件或数据库)
参考链接
CSDN - iOS 3DES加密 和 java 3DES 解密
详细内容#####1. 首先进入头文件,添加必要的 Framework
123#import <CommonCrypto/CommonDigest.h>#import <CommonCrypto/CommonCryptor.h>#import <Security/Security.h>
#####2. iOS 端实现代码
12345678910111213141516171819202122232425262728293031323334353637383940414243 ...
数据加密 - DES 加密(包含PHP服务器端解密)
变更记录
序号
录入时间
录入人
备注
1
2015-02-27
Alfred Jiang
-
2
2015-12-22
Alfred Jiang
-
方案名称数据加密 - DES 加密(包含PHP服务器端解密)
关键字数据加密 \ 加密 \ 解密 \ DES
需求场景
移动端与服务器敏感数据通讯
移动端本地部分需要保存的敏感数据(NSUserDefaults、文件或数据库)
参考链接
iOS Objective-C 與 PHP DES 加解密演算法實作
详细内容#####1. 首先进入头文件,添加必要的 Framework
1#import <CommonCrypto/CommonCryptor.h>
#####2. iOS 端实现代码
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657//解密-(NSString*) decryptUseDES:(NSString*)cipherText ...
音视频 - 使用 POVoiceHUD 实现语音录制
变更记录
序号
录入时间
录入人
备注
1
2015-03-20
Alfred Jiang
-
2
2015-12-23
Alfred Jiang
-
方案名称音视频 - 使用 POVoiceHUD 实现语音录制
关键字音视频 \ Voice \ 语音录制 \ POVoiceHUD \ 音频
需求场景
需要实现语音录制需求时
参考链接
GitHub - POVoiceHUD
详细内容#####1. 引入以下 framework
1234AVFoundation.frameworkAudioToolbox.frameworkCoreGraphics.frameworkQartzCore.framework
#####2. 在 ViewDidLoad 中实例化
12345self.voiceHud = [[POVoiceHUD alloc] initWithParentView:self.view];self.voiceHud.title = @"Speak Now";[self.voiceHud setDelegate:self];[self. ...
UIImageView - 使用 LBBlurredImage 实现图像模糊效果
变更记录
序号
录入时间
录入人
备注
1
2015-03-18
Alfred Jiang
-
2
2015-08-17
Alfred Jiang
-
3
2015-12-23
Alfred Jiang
-
方案名称UIImageView - 使用 LBBlurredImage 实现图像模糊效果
关键字UIImageView \ 图像模糊 \ LBBlurredImage \ UIImage \ 模糊 \ 半透明 \ 毛玻璃 \ 高斯模糊
需求场景
实现页面或图片的模糊效果
参考链接
GitHub - LBBlurredImage
知乎 - iOS 7 的实时毛玻璃模糊 (live blur) 效果渲染需要多大的系统开销?
三石·道 - iOS开发使用半透明模糊效果
详细内容使用 LBBlurredImage 实现#####1. 在工程中添加 UIImageView+LBBlurredImage.{h,m} 和 UIImageImage+ImageEffects.{h,m} 文件
#####2. 在需要实现图像模糊的类中引入 UIImageView+LBBlu ...
地图 - 为 Xcode 工程添加自定义初始化位置(载入 gpx 文件)
变更记录
序号
录入时间
录入人
备注
1
2015-03-23
Alfred Jiang
-
2
2015-12-23
Alfred Jiang
-
方案名称地图 - 为 Xcode 工程添加自定义初始化位置(载入 gpx 文件)
关键字地图 \ 坐标 \ 初始位置 \ gpx
需求场景
在模拟器中实现地图位置模拟
在示例场景中实现位置模拟
地图读取默认位置需求
参考链接
XCode 4.2 地点模拟技巧
详细内容#####1. 创建 gpx 文件,可命名为 “TestLocation.gpx”
1New -> File -> iOS -> Resource -> GPX File
#####2. 添加坐标
1234567891011<?xml version="1.0"?><gpx version="1.1" creator="Xcode"> <wpt lat="37.331705" lon="-122.030 ...
UITableView - 使用 EGORefreshTableHeaderView 实现下拉刷新 UITableView
变更记录
序号
录入时间
录入人
备注
1
2015-03-23
Alfred Jiang
-
2
2015-12-23
Alfred Jiang
-
方案名称UITableView - 使用 EGORefreshTableHeaderView 实现下拉刷新 UITableView
关键字UITableView \ EGORefreshTableHeaderView \ 下拉刷新
需求场景
需要实现列表数据的下拉刷新
参考链接
CSDN - IOS详解TableView——内置刷新,EGO,以及搜索显示控制器
GitHub - EGOTableViewPullRefresh
详细内容#####1. EGORefreshTableHeaderView(.h.m)
EGORefreshTableHeaderView.h
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 ...