- 博客(182)
- 资源 (1)
- 收藏
- 关注
原创 ios Url Encode
//ios Url Encode //有时候在请求的参数里里特殊符号比如“+”等。而如果没有encode的话那么传过去的还是” ”,面实际上是%2B。 -(NSString*)UrlValueEncode:(NSString*)str { NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes
2013-11-27 15:03:45 1079
原创 NSDictionary to jsonString || 对象转json格式
NSDictionary to jsonString [self DataTOjsonString:dic] -(NSString*)DataTOjsonString:(id)object { NSString *jsonString = nil; NSError *error; NSData *jsonData = [NSJSONSerialization data
2013-11-27 15:02:42 2530
原创 iOS 动画效果。简单的提示消失
UILabel * label1 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 30)]; label1.text = @"qingjoin"; [self.view addSubview:label1]; [UIView beginAnimations:nil context:n
2013-11-27 15:01:41 1125
原创 NSMutableURLRequest Http 请求 同步 异步
#pragma mark get country code//同步 -(void)getFKjsonCountryCode { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSString *urlString = [NSString s
2013-11-27 15:00:53 818
原创 Xcode missing file or .png is missing from working copy
当不小心在工程文件中删掉文件时。有可能会提示 .xxx is missing from working copy 有可能是SVN引起的。删掉这个文件就好了 如果是单个文件。进入Terminal 相应的路径,svn delete XXX 批量删除 这时候我们打开Terminal(终端) 输入cd 空格 然后把在网上工程到Terminal 回车 输入命令行rm -
2013-11-27 15:00:02 1598
原创 iOS DES 加密转base64
//用法 加密转base 64 NSString *str = [self base64StringFromText:@"qingjoin" withKey:@"key"]; //转base 64 解密 NSString *stred = [self textFromBase64String:str withKey:@"key"]; //文本先进行DES加密。然后再转成
2013-10-09 16:37:16 1224 1
原创 iOS 画虚线
UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 100, 320, 20)]; [self.view addSubview:imageView1]; UIGraphicsBeginImageContext(imageView1.frame.size); //开
2013-09-29 13:18:04 1306
原创 UIFont字体大全
原文地址:UIFont 设置字体作者:青竹居士 http://deep-fish.iteye.com/blog/1678874 UIFont 设置字体 1 label.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:24]; 字体名如下: Font Family: American Typewrite
2013-09-29 13:17:37 576
原创 iOS 里RGB 配色 UIColor colorWithRed
//比如rgb 色值为73、 148 、230 那么ios 里面要在后面加.0f 再除以255 [bline setBackgroundColor:[UIColor colorWithRed:73.0f/255.0f green:148.0f/255.0f blue:230.0f/255.0f alpha:0.5]];
2013-09-29 13:16:48 722
原创 advertisingIdentifier
iOS 7后Mac 地址就不能用了。 不过可以用advertisingIdentifier来取,再多个project 里测试是唯一的,但如果遇到系统升级或是重刷这个就不一定能唯一了。。 这里还要加一个库。AdSupport.framework NSString *adId = [[[ASIdentifierManagersharedManager] advertisingIdentif
2013-09-29 13:16:18 1133
原创 Github 基本操作
.配置Git 首先在本地创建ssh key; $ ssh-keygen -t rsa -C "your_email@youremail.com" 后面的your_email@youremail.com改为你的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的key。 回到github
2013-08-29 16:09:48 558
原创 iOS 两个应用之间的切换
A 跳到B NSURL *urlT = [NSURL URLWithString:@"TestB://XXXXXXX"]; //注意“://”后面可以任意传参数。这些参数传过去后当跳到B时会在-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 这个方法里实现。 if (
2013-08-29 16:08:32 983
原创 iOS7 Sprite Kit 学习
iOS 7有一个新功能 Sprite Kit 这个有点类似cocos2d 感觉用法都差不多。下面简单来介绍下Sprite Kit About Sprite Kit Sprite Kit provides a graphics rendering and animation infrastructure that you can use to animate arbitrary textu
2013-08-13 16:23:57 1375
原创 [UIView setShowsFPS:]: unrecognized selector sent to instance XXX
今天在做sprite Kit game时遇到一个问题。 新建一个项目运行时发现就加了这几句代码无法运行。后来一查原来是storyboard uiview要改一下。改成SKview In your storyboard, did you set the 'custom class' of the VC's root view to SKView? SKView *sprite
2013-08-13 14:21:11 1425
原创 ios Mac 地址获取
//mac address #include // Per msqr #include #include #include //mac address // Return the local MAC addy // Courtesy of FreeBSD hackers email list // Accidentally munged du
2013-07-31 13:08:30 565
原创 iOS 截屏
UIImage *snapshot; CGImageRef cgScreen = UIGetScreenImage(); if (cgScreen) { snapshot = [UIImage imageWithCGImage:cgScreen]; CGImageRelease(cgScreen); } CGR
2013-07-31 13:06:24 664
原创 objective-c 字符串基本操作
1.定义一个字符串a, 截取a 的某一个部分,复制给b, b必须是int型 NSString *a = @"1.2.30"; int b= [[a substringWithRange:NSMakeRange(4,2)] intValue]; NSLog(@"a:%@ n",a ); NSLog(@"b:%d",b ); 解析如下:substringWithRange: 专
2013-07-30 11:22:10 603
原创 Xcode4.6 自制iOS可用的 Framework
First of all:新建一个空白project. File->New->Project 然后新建两个文件 File->New->File 如图 然后选择targets add Target 注意:iOS工程的选项里面没有Bundel,所以选择Mac里面的 删除Build Phases里面的link库如图(删除Cocoa framework
2013-07-17 14:08:37 944
原创 iOS 获取流量
#include #include #include #include - (NSArray *)getDataCounters { BOOL success; struct ifaddrs *addrs; const struct ifaddrs *cursor; const struct if_data *n
2013-07-03 10:00:39 704
原创 The executable was signed with invalid entitlements
The executable was signed with invalid entitlements 这个错误有可能是因为 Bundle Identifier 错误 这里的XXX一定要跟你的证书上保持一致!(如果你是在真机上调试的话!)
2013-07-03 09:59:57 663
原创 iOS7 文本转语音 AVSpeechSynthesizer
http://www.cnblogs.com/qingjoin/archive/2013/06/28/3160945.html OS7 的这个功能确实不错。我刚试了下,用官方提供的API ,简单的几句代码就能实现文本转语音! Xcode 5.0 工程建好后首先把AVFoundation.framework 加入到工程 AVSpeechSynthes
2013-06-28 15:25:03 1688
原创 The document "ViewController.xib" could not be opened. Could not read archive.
The document "ViewController.xib" could not be opened. Could not read archive. Please use a newer version of Xcode. Consider changing the document's Development Target to preserve compatibility.
2013-06-27 14:29:35 4065
原创 毫秒 转时、分、秒
int hS =_timeValue; //_timeValue 单位毫秒 hS = hS%1000; //毫秒秒 int h = sd/(60*60); //时 int m = sd/60 - h*60; //分 int s = sd - h*(60*60) - m*60; //秒
2013-06-09 13:28:24 975
原创 Apple Mach-O Linker Error
duplicate symbol _kConnectionDown in : //这个错误表示工程中用到了相同的类名 。或const名, 从这个错误来看。_kConnectionDown这个变量重复定义了。只要找到它改回来就可以了。 /user/XXX/XX/X.0 duplicate symbol XXX in : /user/XXX/XX/X.0 ld:
2013-05-31 17:17:06 700
原创 延迟1秒触发performSelector
[self performSelector:@selector(changeText:) withObject:@"Happy aha" afterDelay:1];
2013-05-31 17:17:03 482
原创 ios 排序
NSArray *_firstArray = [NSArrayarrayWithObjects:@"ccccc",@"bbbbb",@"ddddd",@"aaaaa",nil]; NSArray *_sortedArray= [_firstArray sortedArrayUsingSelector:@selector(compare:)]; NSLog(@"未排序:%@",_firs
2013-05-31 17:17:01 494
原创 objc 全局
TestObj.h /**********************/ #import @interface TestObj : NSObject @property(nonatomic, retain)NSString *str; +(TestObj*)shareObj; @end TestObj.m /**********************
2013-05-31 17:16:59 686
原创 -[__NSCFString objectFromJSONString]: unrecognized selector sent to 解决办法
这个问题一般是用到jsonkit的时候引起的 找到 targets -> Linking->Other Linker Flags 添加-ObjC 一般情况下是没有问题了。 另外一种情况: 如果是做静态库的开发。那么有可能客户端不能添加 -ObjC 我就是遇到过这种情况 。解决办法。 原因是我的targets 静态库的targets 里面包含了 appDele
2013-05-31 17:16:57 1399
原创 UIAlertview改变按钮位置 大小
//versionAlertView最好设为全局 versionAlertView = [[UIAlertView alloc] initWithTitle:@"标题" message:@"One Style\nOne Style\nOne Style\nOne Style\nOne Style\nOne Style\nOne Style\nOne Style\nOne Style\nOne S
2013-05-31 17:16:54 674
原创 ios 二维码生成 扫瞄
// // ViewController.m // ZBarDemo // // Created by qingyun on 4/9/13. // Copyright (c) 2013 qingyun. All rights reserved. // #import "ViewController.h" #import "QRCodeGenerator.h" @i
2013-05-31 17:16:52 616
原创 ios 获取mac 地址
#include #include #include if.h> #include - (NSString *) macaddress { int mib[6]; size_t len; char *buf; unsign
2013-05-31 17:16:49 480
原创 iOS 常用的宏
原文地址:http://www.cocoachina.com/applenews/devnews/2013/0328/5907.html #define NavigationBar_HEIGHT 44 #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)#define SCREEN_HEIGHT ([UIScreen mai
2013-05-31 17:16:47 459
原创 ParticleDesigner 粒子编辑器使用
Particle designer粒子编辑器可到这里下载(包含授权码):http://www.cocoachina.com/downloads/code/2012/0706/4424.html -- CCParticleSystem是所有粒子系统的父类 -- CCParticleSystemPoint、CCParticleSystemQuad (点粒子和方形粒子系统,都继承了CCParticl
2013-05-31 17:16:45 849
原创 cocos2d 左下角三行
cocos2d 左下角三行去掉方法。 // Display FSP and SPF [director_setDisplayStats:NO]; //设置为no就可以了。在 didFinishLaunchingWithOptions 这个里面设置 第一行表示当前场景的渲染批次 中间一行是渲染每一帧需要的时间 FSP and SPF
2013-05-31 17:16:43 639
原创 iOS 推送,服务器。证书。
两个证书 ios_development.cer push.pl2 到当前目录:把.cer文件转换成.pem文件: $ openssl x509 -in ios_develoment.cer -inform der -out PushChatCert.pem 把私钥.p12文件转换成.pem文件: $ openssl pkcs12 -nocerts -out PushCha
2013-05-31 17:16:40 526
原创 iOS 随机数 不重复
1、获取一个随机整数范围在:[0,100)包括0,不包括100 int x = arc4random() % 100; 2、 获取一个随机数范围在:[500,1000),包括500,不包括1000 int y = (arc4random() % 501) + 500; /***********************/ //生成0~9 NSArra
2013-05-31 17:16:38 954
原创 判断应用第一次启动
/*******************************************/ if(![[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]){ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstLau
2013-05-31 17:16:36 547
原创 iOS MD5 加密算法。
//头文件 #import @interface iOSMD5 : NSObject { } +(NSString *) md5: (NSString *) inPutText ; @end //.m文件 #import "iOSMD5.h" #import "CommonCrypto/CommonDigest.h" @implement
2013-05-31 17:16:34 460
原创 设置相关---blogs-set
"text/javascript"> alimama_pid="mm_30007568_3200872_10537491"; alimama_width=200; alimama_height=200; "http://a.alimama.cn/inf.js" type="text/javascript">      &nbs
2013-05-31 17:16:31 504
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人