Sportica   Sportica

随笔分类 -  objective-c

摘要://iOS DES ECB 模式加密 #importstatic Byte iv[] = {1,2,3,4,5,6,7,8};+(NSString *) encryptUseDES:(NSString *)plainText key:(NSString *)key { NSString *ciphertext = nil; const char *textBytes = [plainText UTF8String]; NSUInteger dataLength = [plainText length]; ... 阅读全文
posted @ 2013-09-30 17:10 qingjoin 阅读(2981) 评论(0) 推荐(0) 编辑
摘要:UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 100, 320, 20)]; [self.view addSubview:imageView1]; UIGraphicsBeginImageContext(imageView1.frame.size); //开始画线 [imageView1.image drawInRect:CGRectMake(0, 0, imageView1.frame.size.width, imageView1.frame.size.... 阅读全文
posted @ 2013-09-24 18:29 qingjoin 阅读(16495) 评论(2) 推荐(0) 编辑
摘要:原文地址:UIFont 设置字体作者:青竹居士 http://deep-fish.iteye.com/blog/1678874UIFont 设置字体1 label.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:24];字体名如下:Font Family: American TypewriterFont: AmericanTypewriterFont: AmericanTypewriter-BoldFont Family: AppleGothicFont: AppleGothicFont Family: Aria 阅读全文
posted @ 2013-09-24 16:00 qingjoin 阅读(10550) 评论(1) 推荐(1) 编辑
摘要://比如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]]; 阅读全文
posted @ 2013-09-24 15:16 qingjoin 阅读(13719) 评论(1) 推荐(0) 编辑
摘要:iOS 7后Mac 地址就不能用了。不过可以用advertisingIdentifier来取,再多个project 里测试是唯一的,但如果遇到系统升级或是重刷这个就不一定能唯一了。。这里还要加一个库。AdSupport.frameworkNSString *adId = [[[ASIdentifierManagersharedManager] advertisingIdentifier] UUIDString]; NSLog(@"divicedentifier:%@",[selfmacaddress]);//50C10807-E87A-476C-9AE4-6BA221838 阅读全文
posted @ 2013-09-24 10:54 qingjoin 阅读(1585) 评论(0) 推荐(0) 编辑
摘要:A 跳到B NSURL *urlT = [NSURL URLWithString:@"TestB://XXXXXXX"]; //注意“://”后面可以任意传参数。这些参数传过去后当跳到B时会在-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 这个方法里实现。 if ([[UIApplication sharedApplication] canOpenURL:urlT]) { [[UIApplication sharedApplication] openU... 阅读全文
posted @ 2013-08-29 12:25 qingjoin 阅读(691) 评论(0) 推荐(0) 编辑
摘要://修改main.m 文件。typedef int (*PYStdWriter)(void *, const char *, int);static PYStdWriter _oldStdWrite;int __pyStderrWrite(void *inFD, const char *buffer, int size){ if ( strncmp(buffer, "AssertMacros:", 13) == 0 ) { return 0; } return _oldStdWrite(inFD, buffer, size);}int main(int argc... 阅读全文
posted @ 2013-08-16 13:29 qingjoin 阅读(912) 评论(0) 推荐(0) 编辑
摘要:iOS 7有一个新功能 Sprite Kit 这个有点类似cocos2d 感觉用法都差不多。下面简单来介绍下Sprite KitAbout Sprite KitSprite Kit provides a graphics rendering and animation infrastructure that you can use to animate arbitrary textured images, orsprites. Sprite Kit uses a traditional rendering loop that allows processing on the contents 阅读全文
posted @ 2013-08-13 16:18 qingjoin 阅读(4232) 评论(0) 推荐(1) 编辑
摘要:今天在做sprite Kit game时遇到一个问题。新建一个项目运行时发现就加了这几句代码无法运行。后来一查原来是storyboard uiview要改一下。改成SKviewIn your storyboard, did you set the 'custom class' of the VC's root view to SKView? SKView *spriteView = (SKView*)self.view; spriteView.showsFPS = YES; spriteView.showsDrawCount = YES; spriteView.sho. 阅读全文
posted @ 2013-08-13 14:20 qingjoin 阅读(3456) 评论(0) 推荐(0) 编辑
摘要://mac address#include // Per msqr#include #include #include //mac address// Return the local MAC addy// Courtesy of FreeBSD hackers email list// Accidentally munged during previous update. Fixed thanks to erica sadun & mlamb.- (NSString *)macaddress{ int mib[6]; size_t ... 阅读全文
posted @ 2013-07-31 13:07 qingjoin 阅读(3641) 评论(0) 推荐(0) 编辑
摘要:UIImage *snapshot; CGImageRef cgScreen = UIGetScreenImage(); if (cgScreen) { snapshot = [UIImage imageWithCGImage:cgScreen]; CGImageRelease(cgScreen); } CGRect rect = CGRectMake(0,125, 640, 750);//创建要剪切的矩形框 这里你可以自己修改 UIImage *res = [UIImage imageWithCGImage:CGImageC... 阅读全文
posted @ 2013-07-31 13:05 qingjoin 阅读(234) 评论(0) 推荐(0) 编辑
摘要: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: 专门截取字符串的一块肉NSMakeRange(4,2) 从第4个字符开始截取,长度为2个字符,(字符串都是从第0个字符开始数的哦~!)b = [a intValue]; 阅读全文
posted @ 2013-07-30 10:55 qingjoin 阅读(1473) 评论(0) 推荐(0) 编辑
摘要:原文地址:http://blog.csdn.net/vipwangl/article/details/8846415最近在学习Parse,但是Parse的中文教程比较少,看到这篇英文教程,把它翻译一下与大家共享,本人的英语水平不是很高,有的地方可能译得不好,望大神轻拍。。原文地址http://www.raywenderlich.com/19341/how-to-easily-create-a-web-backend-for-your-apps-with-parse首先—创建你的后台服务 在开始编写你的app前,你首先要做的是创建你的Parse后台,每个开发人员和每个app都需要一个不同的标识, 阅读全文
posted @ 2013-07-17 18:20 qingjoin 阅读(6814) 评论(1) 推荐(2) 编辑
摘要:First of all:新建一个空白project. File->New->Project然后新建两个文件 File->New->File 如图然后选择targets add Target注意:iOS工程的选项里面没有Bundel,所以选择Mac里面的删除Build Phases里面的link库如图(删除Cocoa framework)接下来修改Build Settinga.Base SDK选择Latest IOS(IOS 6.1)b.Build Active Architecture Only选择NOc.Drad Code Stripping设置为NOd.Mach- 阅读全文
posted @ 2013-07-17 14:04 qingjoin 阅读(2057) 评论(6) 推荐(1) 编辑
摘要:#include #include #include #include - (NSArray *)getDataCounters{ BOOL success; struct ifaddrs *addrs; const struct ifaddrs *cursor; const struct if_data *networkStatisc; int WiFiSent = 0; int WiFiReceived = 0; int WWANSent = 0; int WWANReceived = 0; NSString *na... 阅读全文
posted @ 2013-07-02 18:36 qingjoin 阅读(1616) 评论(0) 推荐(0) 编辑
摘要:The executable was signed with invalid entitlements 这个错误有可能是因为 Bundle Identifier 错误这里的XXX一定要跟你的证书上保持一致!(如果你是在真机上调试的话!) 阅读全文
posted @ 2013-07-02 16:25 qingjoin 阅读(6843) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/qingjoin/p/3160945.htmliOS7 的这个功能确实不错。我刚试了下,用官方提供的API ,简单的几句代码就能实现文本转语音!Xcode 5.0工程建好后首先把AVFoundation.framework 加入到工程 AVSpeechSynthesizer *av = [[AVSpeechSynthesizer alloc]init]; AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:@"Hello qingjoin" 阅读全文
posted @ 2013-06-28 15:22 qingjoin 阅读(7882) 评论(4) 推荐(2) 编辑
摘要: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.Xcode 升到5.0后。再回去用4.6打开的时候 .xib文件就会提示这个错误解决办法:用5.0打开project. 选择.xib文件。然后在右边的列表里找到Interface Bui 阅读全文
posted @ 2013-06-27 14:28 qingjoin 阅读(3400) 评论(2) 推荐(1) 编辑
摘要:UIPanGestureRecognizer *recognizer = [[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)]autorelease]; [recognizer delaysTouchesBegan]; [self.view addGestureRecognizer:recogn... 阅读全文
posted @ 2013-06-24 17:46 qingjoin 阅读(736) 评论(0) 推荐(0) 编辑
摘要:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch. self.viewController = [[[V... 阅读全文
posted @ 2013-06-24 17:26 qingjoin 阅读(220) 评论(0) 推荐(0) 编辑

  Sportica