随笔分类 - objective-c
摘要:openssl pkcs12-inCertificates.p12-outCertificates.pem-nodes需要通过终端命令将这些文件转换为PEM格式:openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-c...
阅读全文
摘要:NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:2] , @"actcode",nil]; //首先设置需要通知的方法。加入通知中心。比如当程序跑到这时就通知游戏 ...
阅读全文
摘要:首先在工程中加入XXX plist 配置文件。 然后在key 输入名字比如allsdk value 里填写.a 文件的名字NSString *plistPath = [[NSBundle mainBundle]pathForResource:@"Pc_sdk" ofType:@"plist"]; ...
阅读全文
摘要:NSData *jsonContent = [[userInfo objectForKey:@"acme"] dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary * jsonDic = nil; NSError *error...
阅读全文
摘要:- ( void ) imageSaved: ( UIImage *) image didFinishSavingWithError:( NSError *)error contextInfo: ( void *) contextInfo { NSLog(@"保存结束"); ...
阅读全文
摘要:[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(deviceOrientationChange) name:UIDeviceOrientationDidChangeNotificationobject:nil];
阅读全文
摘要:Unity 3D 简单工程的创建。与Xcode 导出到iOS 平台请看这Unity3D 学习 创建简单的按钮、相应事件Unity C# 代码using UnityEngine;using System.Collections;using System.Runtime.InteropServices;public class testFeil : MonoBehaviour { [DllImport("__Internal")] private static extern void c_ctest(); // Use this for initializatio...
阅读全文
摘要:-(void)testMove{ moveBtn = [[UIButton alloc ]init]; moveBtn.frame = CGRectMake(0, 30, 60, 60); moveBtn.backgroundColor = [UIColorredColor]; //[moveBtn addTarget:self action:@selector(moveBtn) forControlEvents:UIControlEventTouchDown]; //[moveBtn addTarget:self action:@selector(moveBtnEnd) forCo...
阅读全文
摘要://// ViewController.m// YunPhoto//// Created by qingyun on 3/4/14.// Copyright (c) 2014 qingyun. All rights reserved.//#import "ViewController.h"@interface ViewController ()@end@implementation ViewController@synthesize sheet;- (void)viewDidLoad{ [super viewDidLoad]; UIButton *selectBtn...
阅读全文
摘要:iOS运用keychain 结合[[[UIDevice currentDevice] identifierForVendor] UUIDString]取得设备唯一标识 NSString *identifierStr = [[[UIDevice currentDevice] identifierForVendor] UUIDString] NSString * const KEY_USERNAME_PASSWORD = @"com.snda.app.usernamepassword"; NSString * const KEY_PASSWORD = @"com.sn
阅读全文
摘要:函数:isdigit用法:#include功能:判断字符c是否为数字说明:当c为数字0-9时,返回非零值,否则返回零。函数:islower用法:#include功能:判断字符c是否为小写英文字母说明:当c为小写英文字母(a-z)时,返回非零值,否则返回零。函数:isupper用法:#include功能:判断字符c是否为大写英文字母说明:当c为大写英文字母(A-Z)时,返回非零值,否则返回零。函数:isxdigit用法:#include功能:判断字符c是否为十六进制数字说明:当c为A-F,a-f或0-9之间的十六进制数字时,返回非零值,否则返回零。函数:isalnum用法:#include功能:
阅读全文
摘要:在XCode的以前版本中,如果遇到了[代码]c#/cpp/oc代码:1message sent to deallocated instance 0x6d564f0我们可以使用info malloc-history 0x6d564f0来查看调用堆栈来查看崩溃发生的地方,这种方法这里不作阐述,大家自行百度。在新的XCode里,调试器默认使用LLDB,我就讲一下如何在LLDB状态下定位到由于内存操作不当引起的Crash首先我有一段会发生崩溃的代码:[代码]c#/cpp/oc代码:1NSString *themePath = [[[NSBundle mainBundle] resourcePath]
阅读全文
摘要:-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{NSMutableString *text = [[moneyInputField.text mutableCopy] autorelease];[text replaceCharactersInRange:range withString:string];return [text length] <= 12;}
阅读全文
摘要:$(inherited) "$(SRCROOT)/.a文件所在的文件名"//如果有多个.a文件格式就像这样$(inherited) "$(SRCROOT)/xxxx" "$(SRCROOT)/xx"如果取的是相对是绝对路径那么工程移到别的地方就有可能导致运行出错。所以要改成相对路径
阅读全文
摘要:NSDictionary to jsonString [self DataTOjsonString:dic]-(NSString*)DataTOjsonString:(id)object{ NSString *jsonString = nil; NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object options:NSJSONWritingPrettyPrint...
阅读全文
摘要:UILabel * label1 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 30)]; label1.text = @"qingjoin"; [self.view addSubview:label1]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; [UIView setAnimationDuration:3.0]; ...
阅读全文
摘要:#pragma mark get country code//同步-(void)getFKjsonCountryCode{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSString *urlString = [NSString stringWithFormat:@"http://www.baidu.com"]; NSMutableURLRequest *request = [[[NSMutableURLRequest al...
阅读全文
摘要://ios Url Encode //有时候在请求的参数里里特殊符号比如“+”等。而如果没有encode的话那么传过去的还是” ”,面实际上是%2B。-(NSString*)UrlValueEncode:(NSString*)str{ NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFS...
阅读全文
摘要:当不小心在工程文件中删掉文件时。有可能会提示.xxx is missing from working copy有可能是SVN引起的。删掉这个文件就好了如果是单个文件。进入Terminal 相应的路径,svn delete XXX批量删除这时候我们打开Terminal(终端) 输入cd 空格 然后把在网上工程到Terminal 回车输入命令行rm-rf`find.-typed-name.svn`then the worning is missed ...
阅读全文
摘要://用法 加密转base 64NSString *str = [self base64StringFromText:@"qingjoin" withKey:@"key"];//转base 64 解密 NSString *stred = [self textFromBase64String:str withKey:@"key"];//文本先进行DES加密。然后再转成base64+ (NSString *)base64StringFromText:(NSString *)text withKey:(NSString*)key{ if (t
阅读全文