- 博客(29)
- 收藏
- 关注
原创 iOS 有关环信 移动客服
iOS 有关环信 移动客服的代码 其实就几行代码就可以搞定 //创建会话 [[EMClient sharedClient].chatManager getConversation:@"" type:EMConversationTypeChat createIfNotExist:YES]; ChatViewController *c
2016-06-23 15:23:13 2088
原创 iOS 判断是否连接wifi
+(BOOL)isWIFIConnection;+(BOOL)isWIFIConnection{ BOOL ret = YES; struct ifaddrs * first_ifaddr, * current_ifaddr; NSMutableArray* activeInterfaceNames = [[
2016-06-21 09:28:49 2582
原创 iOS利用AFNetworking(AFN) 实现图片上传
1.上传图片以二进制流的形式上传 1 #pragma mark - 文件上传 2 - (IBAction)uploadImage 3 { 4 /* 5 此段代码如果需要修改,可以调整的位置 6 7 1. 把upload.PHP改成网站开发人员告知的地址 8 2. 把file改成网站开发
2016-06-21 09:13:57 2454 1
原创 iOS 有参数的通知 有对象的参数的通知
//有参数的通知 [[NSNotificationCenterdefaultCenter]postNotificationName:@"YijianSend"object:niluserInfo:@{@"text":self.textViewStr}]; [[NSNotificationCenterdefaultCenter] addObserver:
2016-06-20 08:41:33 2193
原创 iOS QQ的AppID转换16进制的方法
例如 000000000为QQ的AppIDecho 'ibase=10;obase=000000000'|bc
2016-06-20 08:39:25 5875
转载 Mac常用快捷键
对于初次使用Mac系统的筒子们来说可能很难适应,因为Mac系统跟Windows系统在用户使用习惯上有很大的区别。下边我给大家介绍一下Mac的一些操作习惯和常用快捷键。首先看下苹果的键盘,如图:下边一张图是Mac键盘符号所对应的解释,如图:了解了键盘的释义之后,下边是我整理的一些常用的快捷: command
2016-06-23 11:13:36 333
原创 iOS 常写在pch中的设备区分
#define INTERFACE_IS_PAD ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)#define INTERFACE_IS_PHONE ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfac
2016-06-23 11:09:02 596
原创 iOS 手势滑动返回功能
方法一BaseViewController 是要添手势的控制器BaseViewController.m#import "BaseViewController.h"#import "POPAnimation.h"@interface BaseViewController ()UINavigationControllerDeleg
2016-06-23 11:06:15 2674
原创 iOS 填写完身份证后 自动算出 出生日期
-(NSString *)birthdayStrFromIdentityCard:(NSString *)numberStr{ // if(EMPTY_NIL_STR(numberStr))// return nil; NSMutableString *result = [NSMutableStringstringWithCapa
2016-06-22 16:08:16 1327
原创 时间与时间戳的相互转换
NSDate* date = [formatter dateFromString:timeStr]; //------------将字符串按formatter转成nsdate NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式 NSString *nowtimeStr =
2016-06-22 08:53:43 715
原创 iOS 设置UITextView显示文本的光标
建立一个UITextView 默认是启动键盘光标位于首位置UITextView *_textView=[[UITextView alloc]initWithFrame:self.view.frame];_textView.text=textString; //起始位置_textView.selectedRange=NSMakeRange(0,0) ;
2016-06-21 10:29:07 440
转载 iOS NSDate 使用
取当前时间的秒数NSTimeInterval time = [[NSDate date] timeIntervalSince1970];long long int date = (longlong int)time;NSLog(@”date\n%d”, date); //1295322949//把秒数转化成yyyy-MM-dd hh:mm:ss格
2016-06-21 10:27:11 218
原创 iOS 判断是否是数字
// 判断是否是数字+ (BOOL)isPureNumber:(NSString*)string;+ (BOOL)isPureNumber:(NSString*)string{ NSScanner* scan = [NSScannerscannerWithString:string]; long long
2016-06-21 09:29:37 827
原创 iOS 判断身份证号码
//判断身份证号码+ (BOOL)validateIdentityCard: (NSString *)identityCard;//精确判断身份证号码+ (BOOL)validateIDCardNumber:(NSString *)identityCard;//身份证号+ (BOOL)validateIdentityCard: (
2016-06-21 09:27:40 476
原创 iOS 根据生日(单位秒)转换成一个年龄
//根据生日(单位秒)转换成一个年龄+ (double)brithDayToAge:(longlong)birthDay;+ (double)brithDayToAge:(longlong)birthDay{ long long time = birthDay /1000; NSDate *date =
2016-06-21 09:24:28 815
原创 iOS pch中或者common.h中常见的代码
// 是否模拟器#define isSimulator (NSNotFound != [[[UIDevice currentDevice] model] rangeOfString:@"Simulator"].location)//按设备宽度做适配#define SCALE_WIDTH(x) (([UIScreen mainScreen].bounds.si
2016-06-21 09:21:39 366
转载 iOS支付宝支付
转载自http://www.iashes.com/2015-08-762.html 感谢感谢~模拟器支付:iOS支付宝支付官方写的比微信好多了,至少有备注,难道微信给自己写sdk的备注怕公司不给钱?先上一个官方的文档吧:http://pan.baidu.com/s/1jWGEE支付宝的申请资格和流程:1231.企业支付宝账号注册企业账号,
2016-06-21 09:13:27 1242
原创 iOS用户是否开启定位服务
CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; if (kCLAuthorizationStatusDenied == status || kCLAuthorizationStatusRestricted == status) { UIAl
2016-06-21 09:12:23 236
转载 iOS下微信语音播放之切换听筒和扬声器的方法解决方案
[[UIDevice currentDevice] setProximityMonitoringEnabled:YES]; //建议在播放之前设置yes,播放结束设置NO,这个功能是开启红外感应 //添加监听[[NSNotificationCenter defaultCenter] addObserver:self
2016-06-21 09:11:47 1814
原创 获取当前版本信息
+(NSString*)getVersion{ NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary]; NSString* version = [infoDict objectForKey:@"CFBundleShortVersionString"]; return version;
2016-06-21 09:10:53 308
原创 冒泡排序
NSMutableArray *array = [NSMutableArray arrayWithArray:@[@"3",@"1",@"10",@"5",@"2",@"7",@"12",@"4",@"8"]]; for (int i = 0; i for (int j = 0; j 1 - i; j++) { if([[arra
2016-06-21 09:10:21 219
原创 iOS获取 移动设备型号
NSString *deviceVersion = [selfdeviceVersion]; NSLog(@"deviceVersion == %@",deviceVersion);- (NSString*)deviceVersion{ // 需要#import "sys/uts
2016-06-21 09:00:22 315
原创 iOS计算缓存内容大小
// 计算目录大小-(float)folderSizeAtPath:(NSString *)path{ NSFileManager *fileManager=[NSFileManagerdefaultManager]; float folderSize; if ([fileManager fileExistsAtPath:path]) {
2016-06-21 08:53:19 258
原创 iphone尺寸
4 320*480 640 x 960 3.5英寸5 320*568 640 x 1136 4英寸6 375*667 750 x 1334 4.7英寸6p 414*736 1242 x 2208 5.5英寸
2016-06-20 08:42:05 200
原创 iOS 异步加载图片
//异步加载图片 SDWebImageManager *manager = [SDWebImageManagersharedManager]; [manager downloadImageWithURL:[NSURLURLWithString:[NSStringimagePathBySourcePath:mm.user_img_urlWithType:I
2016-06-20 08:38:03 259
原创 判断字符串为6~12位“字符”
- (BOOL)isValidateName:(NSString *)name{ NSUInteger character = 0; for(int i=0; i int a = [name characterAtIndex:i]; if( a > 0x4e00 && a 0x9fff){
2016-06-20 08:35:47 1162
原创 iOS UIAlertController
//UIAlertControllerUIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];// Create the actions.
2016-06-20 08:35:19 226
原创 iOS Base64图片与UIImage的相互转化
Base64图片 -> UIImage- (UIImage *) dataURL2Image: (NSString *) imgSrc{ NSURL *url = [NSURLURLWithString: imgSrc]; NSData *data = [NSDatadataWithContentsOfURL: url];
2016-06-20 08:34:01 3130
原创 xcode版本管理路径
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
2016-06-20 08:29:47 386
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人