随笔分类 -  IOS

摘要:短短两天就在https://git.oschina.net/gangwang/MTNET这里收获15个星 github 5星, 值得收藏!MTNET 自用ios网络库开源, 自用很久了,在数歀上架的app中运行稳定可靠~ 特意开源出来,有兴趣的同学可以看一下https://github.com/Ga... 阅读全文
posted @ 2015-10-16 17:52 Gang.Wang 阅读(943) 评论(0) 推荐(1)
摘要:为了加速小团队app的测试流程做了这个东西,www.xunce.net 主要特性: web: 一键上传app,方便随时下载 备注测试要点 添加附件,如checklist等文档 自动识别app版本,名称等信息,不再因为测试版本多而混乱 支持iOS & And... 阅读全文
posted @ 2014-09-04 14:58 Gang.Wang 阅读(922) 评论(0) 推荐(0)
摘要:I got the same error when uploading my app. Moving all icon files to the Asset Catalog works if your app supports iOS 5.0 and up.If your app still needs to support lower versions of iOS (like mine), the solution is to use the CFBundleIconFiles key in the project plist file. In my case, my app is an 阅读全文
posted @ 2013-10-08 09:44 Gang.Wang 阅读(6590) 评论(0) 推荐(0)
摘要:https://github.com/ksuther/KSImageNamed-Xcode好用,各位记得安装啊 阅读全文
posted @ 2013-08-08 14:17 Gang.Wang 阅读(464) 评论(0) 推荐(0)
摘要:If you want do dissmiss a UISearchBar with an SearchBarController, just use this Code:[self.searchDisplayController setActive:NO animated:YES]; 阅读全文
posted @ 2013-08-06 10:05 Gang.Wang 阅读(561) 评论(0) 推荐(0)
摘要:利用NSObject类中的methodForSelector:方法,可以获得一个指向方法实现的指针,并可以使用该指针直接调用方法实现,当一个消息要被发送给某个对象很多次的时候,可以直接使用methodForSelector:来进行优化,其中,methodForSelector:是由Cocoa Runtime System提供的,而不是Objective-C本身的语言特性。这里需要注意转换过程中函数类型的正确性,包括返回值和参数,而且这里的前两个参数需要显示声明为id和SEL。type voidsetterFuncvoid (*setter)(id, SEL, BOOL);/////////// 阅读全文
posted @ 2012-06-14 15:41 Gang.Wang 阅读(4097) 评论(0) 推荐(0)
摘要:struct timeval {time_t tv_sec; /* seconds */suseconds_t tv_usec; /* microseconds */};millisecond 毫秒microsecond 微秒timeval表示一个时间点,比如:timeval.tv_sec = 1 (s)timevat.tv_usec = 500 000 (μs) 阅读全文
posted @ 2012-06-06 18:12 Gang.Wang 阅读(671) 评论(0) 推荐(0)
摘要:Where is pngcrush for Xcode 4.3?Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/binpngcrush的使用pngcrush -d decresults -revert-iphone-optimizations *.png(-d是输出文件夹的名称)批量将png图片转换成crushpng图片的命令为:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -d decre 阅读全文
posted @ 2012-06-06 17:36 Gang.Wang 阅读(3076) 评论(0) 推荐(0)
摘要:在使用中发现前者比后者的速度要快出很多, 测试了一下,前者所花费的时间是后者的的1/4左右。 阅读全文
posted @ 2012-06-04 14:41 Gang.Wang 阅读(828) 评论(0) 推荐(0)
摘要:如何判定一个点P是否存在于指定的三角形ABC内,这肯定是一个简单的问题,本文仅用一个图形界面程序展示了该问题,有兴趣的朋友可以看看。(2008.07.24最后更新)在此处使用一种常见且简便的方法:如果三角形PAB,PAC和PBC的面积之和与三角形ABC的面积相等,即可判定点P在三角形ABC内(包括在三条边上)。:) 阅读全文
posted @ 2012-05-23 11:01 Gang.Wang 阅读(523) 评论(1) 推荐(0)
摘要:Error launching remote program:No such file or directory (/private/var/mobile/Applications/3E6A33F8-52EE-4A0B-AB9F-A122B7C42045/Test.app/Test)Here:First try restarting Xcode. If it doesn't work, then try hard reset of your device. This happens to me when I change the bundle identifier of my app. 阅读全文
posted @ 2012-04-23 10:48 Gang.Wang 阅读(2609) 评论(0) 推荐(0)
摘要:调度技巧一:程序在崩溃的时候,xcode经常没有给出准确的堆栈信息,而是定位在了main方法里,这个让人很是头疼,又怀念起了vs, 其实xcode只要装简单设置一下,就能准确给出堆栈信息了, 打开xcode左边的Breakpoint Navigator ,点击下面的+号添加一个Exception Breakpoint,可以选择 All, 然后再运行试试,Crash后,就会在在抛出异常的时候停下来了,吼吼。调度技巧二:另一种Crash,EXC_BAD_ACCESS ,这个比较头疼,因为Crash的时候,可能是比较早之前的某个变量释放了,现在访问时出问题。Console里也没显示什么日志。开Sch 阅读全文
posted @ 2012-04-20 18:21 Gang.Wang 阅读(1638) 评论(2) 推荐(0)
摘要://在图片边缘添加一个像素的透明区域,去图片锯齿 CGRect imageRrect = CGRectMake(0, 0,imageView.frame.size.width, imageView.frame.size.height); UIGraphicsBeginImageContext(imageRrect.size); [imageView.imagedrawInRect:CGRectMake(1,1,imageView.frame.size.width-2,imageView.frame.size.height-2)]; imageView.image = UIGraphi... 阅读全文
posted @ 2012-04-06 20:22 Gang.Wang 阅读(1062) 评论(0) 推荐(0)
摘要:dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // in thread dispatch_async(dispatch_get_main_queue(), ^{ // main thread }); }); 阅读全文
posted @ 2012-04-05 10:54 Gang.Wang 阅读(504) 评论(0) 推荐(0)
摘要:note:I just create test app and test. So for devices with out retina: ImageName.png - For iPhone/iPod ImageName~ipad.png -- For iPad For devices with retina display: ImageName@2x~ipad.png -- For iPad ImageName@2x.png - For iPhone/iPod And you can still use @2x if you iPhone high resolution image and 阅读全文
posted @ 2012-03-14 14:25 Gang.Wang 阅读(399) 评论(0) 推荐(0)
摘要:可以调用UIViewController的isViewLoaded方法来判断视图是否已经装载完成。 阅读全文
posted @ 2012-01-14 16:18 Gang.Wang 阅读(763) 评论(0) 推荐(0)
摘要:在ios,blocks是对象,它封装了一段代码,这段代码可以在任何时候执行。Blocks可以作为函数参数或者函数的返回值,而其本身又可以带输入参数或返回值。它和传统的函数指针很类似,但是有区别:blocks是inline的,并且它对局部变量是只读的。Blocks的定义: int (^Multiply)(int, int) = ^(int num1, int num2) {return num1 * num2;};定义了一个Multiply的blocks对象,它带有两个int参数,返回int。等式右边就是blocks的具体实现,注意{}blocks体里的;。Blocks可以访问局部变量,但是不能 阅读全文
posted @ 2012-01-04 21:52 Gang.Wang 阅读(4665) 评论(0) 推荐(1)
摘要:下面代码示范了如何自动计算UILabel尺寸以适应文本的展示:NSString * myText = [NSString stringWithString:@"some text"];//获取到文本大大小CGFloat constrainedSize = 265.0f; //其他大小也行UIFont * myFont = [UIFont fontWithName:@"Arial" size:19]; // UILabel使用的字体CGSize textSize = [myText sizeWithFont: myFont constrainedToSiz 阅读全文
posted @ 2011-12-08 14:10 Gang.Wang 阅读(1646) 评论(0) 推荐(0)
摘要:Object-C 中的Selector 概念Andrew Huang<bluedrum@163.com> 转载请注明作者和联络方式 在iphone程序中会大量看到@selector这样的用法。<<iphone开发基础>花了很大一个篇幅来解析这个语法,但是不知 是翻译问题,还是解释过细,不大看得懂,很是不给力.直到程序用这个语法,并且仔细看了一些解析文章。才明白这一语法。 简而言之,你可以理解 @selector()就是取类方法的编号,他的行为基本可以等同C语言的中函数指针,只不过C语言中,可以把函数名直接赋给一个函数指针,而Object-C的类不能直接应用函数指针 阅读全文
posted @ 2011-12-05 11:29 Gang.Wang 阅读(456) 评论(0) 推荐(0)
摘要:@interface YkMainViewController : UIViewController <YkFlipsideViewControllerDelegate>{ NSOperationQueue *operationQueue; BOOL b_init;}@interface MyTask : NSOperation{ int operationId;}@property int operationId;@end#import "MyTask.h"@implementation MyTask@synthesize operationId;- (voi 阅读全文
posted @ 2011-11-24 11:30 Gang.Wang 阅读(1045) 评论(1) 推荐(0)