Fork me on GitHub

2012年3月19日

摘要: IOS 入门开发之使用XCODE4制作静态库详解注意:首先确保你的XCODE4使用IOS5,否则请下载IOS5在继续阅读。IOS程序是由Objective-c语言构成,而是Objective-c语言中每一个类又分成.h .m 文件。静态库可以将这些程序的类封装成一个.a文件,第三方应用程序只需要拿到这个.a文件和代码对应的.h文件即可使用静态库中封装的方法。总的来说IOS静态库适合去制作第三方提供的SDK,废话不多说了我们直接进正题。首先打开Xcode4创建一个静态库工程,如下图选择Framework&Library ->Cocoa Touch Static Library (创 阅读全文
posted @ 2012-03-19 22:08 pengyingh 阅读(2317) 评论(0) 推荐(0)
摘要: -(IBAction)button:(id)sender{ UIButton* button = (UIButton*)sender; UITableViewCell* buttonCell = (UITableViewCell*)[sender superview]; NSUInteger row = [[tableView indexPathForCell:buttonCell]row]; } 阅读全文
posted @ 2012-03-19 21:24 pengyingh 阅读(2737) 评论(1) 推荐(0)
摘要: 默认情况下。是有生成,可能你不知道在哪里。Xcode-->perferences--> locationsDerived Data,下面有一个路径:/Users/Liam/Library/Developer/Xcode/DerivedData这个就是默认的生成路径。点击旁边的箭头就可跳转到该文件夹。这里不值程序的目标文件,还有其他的生成的文件。如果你想在项目中也生成一份,那么就点击Advanced按钮。将Build Location,选择“locations specified by targets”就可以了。这时你在Build,那么项目路径下就会产生Build目录。targets 阅读全文
posted @ 2012-03-19 21:23 pengyingh 阅读(4248) 评论(0) 推荐(0)
摘要: 前置简短概述引入内联函数的目的是为了解决程序中函数调用的效率问题。 函数是一种更高级的抽象。它的引入使得编程者只关心函数的功能和使用方法,而不必关心函数功能的具体实现;函数的引入可以减少程序的目标代码,实现程序代码和数据的共享。但是,函数调用也会带来降低效率的问题,因为调用函数实际上将程序执行顺序转移到函数所存放在内存中某个地址,将函数的程序内容执行完后,再返回到转去执行该函数前的地方。这种转移操作要求在转去前要保护现场并记忆执行的地址,转回后先要恢复现场,并按原来保存地址继续执行。因此,函数调用要有一定的时间和空间方面的开销,于是将影响其效率。特别是对于一些函数体代码不是很大,但又频繁地被调 阅读全文
posted @ 2012-03-19 10:38 pengyingh 阅读(30856) 评论(0) 推荐(1)
摘要: 论坛会员kibernet分享的iOS Framework 制作教程,并且不是静态包。我们使用一种变通的方法来制作 iOS framework,废话不多说,上步骤:1.打开Xcode创建一个“Cocoa Touch Static Library”工程,并删除现有的target.2.右键project选择添加New Target,在弹出的窗口中找到Cocoa ,在Cocoa右侧窗口中选择“Loadable Bundle”。注意:到这步的时候不要选择framework,应为framework是MAC OS上的,iOS是不支持的,但是iOS 支持“Loadable Bundle(cfbundle)”3 阅读全文
posted @ 2012-03-19 10:35 pengyingh 阅读(477) 评论(0) 推荐(0)
摘要: Previously I explainedhow to make a static librarythat simultaneously supports multiple different CPUs. At that time I was ignorant to the reason why there are no means to make iPhone frameworks. But I did not give up searching, especially since apparently a few individuals seemed to have pulled it 阅读全文
posted @ 2012-03-19 10:32 pengyingh 阅读(200) 评论(0) 推荐(0)
摘要: For some reason Apple reserves the ability to create iPhone frameworks for their own use. They are a very useful ability to have because they package headers together with a universal binary. „Universal“ meaning that you get binary code for multiple platforms rolled into a single file. Frameworks ar 阅读全文
posted @ 2012-03-19 10:31 pengyingh 阅读(367) 评论(0) 推荐(0)
摘要: 很多iPhone聊天程序消息显示都喜欢做成iChat的泡泡样式,这样是不是很apple呢?那么下面用一种简单的方法来实现它。主要通过UIlabel的sizeToFit方法自动计算文本区域大小UIImage的- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight;方法拉伸图片可以根据文本内容自动适应算泡泡高度- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWid 阅读全文
posted @ 2012-03-19 10:29 pengyingh 阅读(374) 评论(0) 推荐(0)
摘要: 一,关于空行A:.h中的空行1,文件说明与头文件包涵(#import)之间空1行2,头文件包涵(#import)之间,如果需要分类区别,各类别之间空1行3,头文件包涵(#import)与@class之间空2行4,@interface与@class之间空一行5,头文件{}里面,空1行开始声明对象成员,如果需要分类区别,各类别之间空1行6,{}外空1行,书写属性,如果需要分类区别,各类别之间空1行7,空1行开始写方法,如果需要分类区别,各类别之间空1行8,方法完成后,空1行@end9,如果需要声明protocal,空2行接着写。通常protocal写在@end后面,但是声明在@interface前 阅读全文
posted @ 2012-03-19 10:23 pengyingh 阅读(4424) 评论(0) 推荐(0)
摘要: 原文来自:http://www.raywenderlich.com/tutorials感谢Ray Wenderlich带头组织了这样一个团队。例子讲解详尽,从helloworld到cocos2d,Unity游戏引擎,从本地应用到网络交互,从苹果自有API到第三方库,涉及范围非常广泛。。。(Ray Wenderlich功力也足够深厚,老外就是好啊,感谢Ray Wenderlich的无私奉献)内容不断更新,目前Ray Wenderlich在招这个系列的合作者(http://www.raywenderlich.com/5037/looking-for-more-tutorial-writers),如 阅读全文
posted @ 2012-03-19 10:22 pengyingh 阅读(2755) 评论(0) 推荐(0)
摘要: iOS上如何制作自己的Framework呢?(不是静态库)请看stackoverflow上的提问:http://stackoverflow.com/questions/4065052/how-to-build-a-framework-or-library-for-other-developers-the-secure-way解决办法1,通过命令行脚本http://www.cocoanetics.com/2010/04/making-your-own-iphone-frameworks/由cocoa的Framework演变而来2,通过hack bundlehttp://www.cocoaneti 阅读全文
posted @ 2012-03-19 10:12 pengyingh 阅读(3311) 评论(0) 推荐(1)
摘要: NSString *trimmedString = [description stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 阅读全文
posted @ 2012-03-19 10:08 pengyingh 阅读(405) 评论(0) 推荐(0)
摘要: UIWebView的唯一一个subview就是UIScrollView,不过苹果并没有提供直接的访问方式给scrollview,因此当你直接这么使用scrollview的时候uiwebview.scrollview,编译没有错误,但是运行的时候会提示[UIWebView scrollView]: unrecognized selector sent to instance因为webview的scrollview是一个苹果私有的api因此我们需要利用一些小trick来获得它的scrollview代码如下:First we will pull the UIScrollView out from t 阅读全文
posted @ 2012-03-19 10:06 pengyingh 阅读(613) 评论(0) 推荐(0)
摘要: Object-C获取自1970年以来的毫秒数NSTimeInterval time = [[NSDate date] timeIntervalSince1970];// NSTimeInterval返回的是double类型,输出会显示为10位整数加小数点加一些其他值// 如果想转成int型,必须转成long long型才够大。NSTimeIntervaltime = [[NSDate date]timeIntervalSince1970];longlongdTime = [[NSNumber numberWithDouble:time]longLongValue];// 将double转为lo 阅读全文
posted @ 2012-03-19 10:05 pengyingh 阅读(6566) 评论(0) 推荐(0)
摘要: - (void)connectionDidFinishLoading:(NSURLConnection *)connection {[connection release];NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];[responseData release];NSError *error;SBJSON *json = [[SBJSON new] autorelease];NSArray *luckyNumbers = [json o 阅读全文
posted @ 2012-03-19 10:03 pengyingh 阅读(2448) 评论(0) 推荐(0)

导航