objective-c
文章平均质量分 56
bo_xiaozhao
这个作者很懒,什么都没留下…
展开
-
电子钟-带后台运行
电子钟-带后台运行原创 2011-01-21 14:34:46 · 117 阅读 · 0 评论 -
cocos2d 总结:四 背景的循环移动
1:CCSpriteFrameCache1): 从*.plist文件中读取内容设置 CCSpriteFrameCache ,该对象是一个全局对象// Load all of the game's artwork up front. CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSprite...原创 2010-11-08 14:34:37 · 182 阅读 · 0 评论 -
使用NSOperation建立多任务网络连接
博主:易飞扬 原文链接 : http://www.yifeiyang.net/iphone-web-development-skills-of-the-articles-3-use-a-multi-task-network-connection-nsoperation/ 转载请保留上面文字。iPhone开发技巧之网络篇(3)--- 使用NSOperation建立多任务网络连接 在网络应...原创 2010-11-15 15:04:30 · 112 阅读 · 0 评论 -
多线程之NSInvocationOperation
多线程之NSInvocationOperationT 多线程编程是防止主线程堵塞,增加运行效率等等的最佳方法。而原始的多线程方法存在很多的毛病,包括线程锁死等。在Cocoa中,Apple提供了 NSOperation这个类,提供了一个优秀的多线程编程方法。本次介绍NSOperation的子集,简易方法的NSInvocationOperation:@implementatio...原创 2010-11-15 15:10:17 · 57 阅读 · 0 评论 -
UITabBar 和獨立的 UItableView 問題?这个问题俺也遇到了
用TabView時,每一個Tab各自獨立指定xib,碰到 TableView不知道為甚麼就是有問題現在 mainwindow 在 IB 大概是這樣:Tab Bar Controller|-Navigation Controller|-Navigation Controller...|-Navigation Controller |-Navigation Bar...原创 2010-12-08 11:20:37 · 77 阅读 · 0 评论 -
iphone 日期计算
-(NSDate *)getPriousDateFromDate:(NSDate *)date withMonth:(int)month{ NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setMonth:month]; NSCalendar *calender = [[NSCal...原创 2010-12-08 17:06:26 · 321 阅读 · 0 评论 -
navigation bar 自定义背景图片
在你要写navigation bar的m文件前面放一段这个: @interface UINavigationBar (MyCustomNavBar) @end @implementation UINavigationBar (MyCustomNavBar) - (void) drawRect:(CGRect)rect { UIImage *barIm...原创 2010-12-09 10:18:29 · 165 阅读 · 0 评论 -
[iPhone][cocoa] 如何计算两个日期之间的天数
问题: 如何计算两个日期之间的天数使用到的类: NSDate NSDateComponents NSCalendar1: NSDate objects represent a single point in time.2: NSDateComponentsNSDateComponents encapsulates the components of a date in an extend...原创 2010-12-09 15:23:29 · 122 阅读 · 0 评论 -
iphone hpple 解析html,xml
使用Objective-C解析HTML或者XML,系统自带有两种方式一个是通过libxml,一个是通过NSXMLParser。 不过这两种方式都需要自己写很多编码来处理抓取下来的内容,而且不是很直观。 有一个比较好的类库hpple,它是一个轻量级的包装框架,可以很好的解决这个问题。 它是用XPath来定位和解析HTML或者XML。 安装步骤: -加入 ...原创 2011-07-19 16:21:27 · 84 阅读 · 0 评论 -
UItableView cell 自适应高度
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifie...原创 2011-03-15 21:27:15 · 84 阅读 · 0 评论 -
iOS-动态调整UITableViewCell的高度
OS-动态调整UITableViewCell的高度iOS开发文档, by 友盟翻译组 stefaliu. 大概你第一眼看来,动态调整高度是一件不容易的事情,而且打算解决它的第一个想法往往是不正确的。在这篇文章中我将展示如何使图表单元格的高度能根据里面文本内容来动态改变,同时又不必子类化UITableViewCell。你当然可以通过子类化它来实现,但是这样做会使得代码复杂因为设置高度是在图表本身...原创 2011-03-15 21:32:53 · 138 阅读 · 0 评论 -
cocos2d 总结:二scenes and layers
scenes and layers 1:显示的第一个场景 runWithScene[[CCDirector sharedDirector] runWithScene:[FirstScene scene]]; 2:场景转换 replaceScene(1)有转换效果 CCSlideInBTransition* transition = [CCSlideInBTrans...原创 2010-11-08 13:50:34 · 75 阅读 · 0 评论 -
cocos2d 总结:一
1:在创建CCLayer的子类时,默认的情况下,不能响应触摸事件在-(id)init { }打开事件处理: // enable touch input self.isTouchEnabled = YES; // enable accelerometer input self.isAccelerometerEnable...原创 2010-11-08 13:32:45 · 77 阅读 · 0 评论 -
激活 iPhone通过 GPRS 连接服务器功能的代码
如果您的 iPhone 应用里含有连接服务器的功能,也许会遇到这种问题:WiFi 环境下连接正常,但用 GPRS 不能直接连接。因为纯 C 的 socket 不能激活 GPRS,而 Apple 自带的 API 可以。所以要使用 GPRS 连接功能,必须在程序启动时要运行一下这段代码-(void)activeGPRSThread{ NSError *error; NSURLRespons...原创 2011-05-13 15:14:12 · 125 阅读 · 0 评论 -
在iPhone播放背景音乐和按键生效的代码
作者 lhp7424521 , 原帖 http://www.cocoachina.com/bbs/read.php?tid-19166.html1、背景音乐播放 支持mp3格式 循环播放长音乐这种播放音乐的方式导入框架#import <AVFoundation/AVFoundation.h>;NSString *musicFilePath = [[NSBundle mainBun...原创 2010-10-28 15:24:36 · 187 阅读 · 0 评论 -
NSScanner类参考
NSString *string = @"Product: Acme Potato Peeler; Cost: 0.98 73\nProduct: Chef Pierre Pasta Fork; Cost: 0.75 19\nProduct: Chef Pierre Colander; Cost: 1.27 2\n"; NSCharacterSet *semicolonSet;NSSc...原创 2011-02-24 16:35:57 · 65 阅读 · 0 评论 -
时间运算之Dates
Creating Date ObjectsNSTimeInterval secondsPerDay = 24 * 60 * 60;NSDate *tomorrow = [NSDate dateWithTimeIntervalSinceNow:secondsPerDay];NSDate *yesterday = [NSDate date...原创 2011-02-24 16:49:43 · 231 阅读 · 0 评论 -
时间运算之Calendars
Creating a Calendar 1:You create a calendar object by specifying an identifier for the calendar you want. Mac OS X provides data for several different calendars—Buddhist, Chinese, Gregorian, He...原创 2011-02-24 17:07:19 · 210 阅读 · 0 评论 -
NSNumberFormatter
Formatter Styles NSNumberFormatterNoStyle, NSNumberFormatterDecimalStyle, NSNumberFormatterCurrencyStyle, NSNumberFormatterPercentStyle, NSNumberFormatterScientificStyle, NSNumberForm...原创 2011-02-24 17:26:40 · 94 阅读 · 0 评论 -
NSDateFormatter
Formatter Styles: NSDateFormatterNoStyle, NSDateFormatterShortStyle, NSDateFormatterMediumStyle,NSDateFormatterLongStyle,NSDateFormatterFullStyle. // assume default behavior set fo...原创 2011-02-24 17:33:54 · 92 阅读 · 0 评论 -
NSSortDescriptor
Specifying Sorts Using NSSortDescriptor Let’s assume, as an example, that we have an array (an instance of NSArray) containing instances of a custom class, Employee (that meets the requirements...原创 2011-02-24 17:51:33 · 52 阅读 · 0 评论 -
Post a UIImage to the web
http://iphone.zcentric.com/2008/08/29/post-a-uiimage-to-the-web/ Post a UIImage to the web So here is something a lot ofpeople have been wondering to do in the forums. How do I take a UIImage...原创 2011-03-01 20:31:52 · 97 阅读 · 0 评论 -
发送Http请求(POST GET)的方法
我们知道Http有Get和Post两种方法,我们分开说吧. 另注: 今天讲的方法是同步的请求, 异步的方法我还没试过, 不知道有没有使用异步的需求, 有的话于发上来和大家分享. 1.Get方法 1.1 使用NSMutableURLRequest view plaincopy to clipboardprint? NSURL* url = [NSURL U...原创 2011-03-01 20:47:11 · 248 阅读 · 0 评论 -
iphone上让方形的图片圆角显示
UIImageView * headerImage = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 10.0, 64.0, 64.0)];headerImage.image = contactPhoto;CALayer * layer = [headerImage layer];[layer setMasksToBoun...原创 2011-03-17 17:07:54 · 110 阅读 · 0 评论 -
iPhone网络开发
一:确认网络环境3G/WIFI 1. 添加源文件和framework 开发Web等网络应用程序的时候,需要确认网络环境,连接情况等信息。如果没有处理它们,是不会通过Apple的审查的。 Apple 的 例程 Reachability 中介绍了取得/检测网络状态的方法。要在应用程序程序中使用Reachability,首先要完成如下两部: 1.1. 添加源文件:...原创 2011-03-17 17:20:59 · 120 阅读 · 0 评论 -
iphone 下AsyncSocket网络库编程
iphone的标准推荐CFNetwork C库编程.但是编程比较烦躁。在其它OS往往用类来封装的对Socket函数的处理。比如MFC的CAsysncSocket.在iphone也有类似于开源项目.cocoa AsyncSocket库 官方网站:http://code.google.com/p/cocoaasyncsocket/ 它用来简化CFnetwork的调用. 一.在项...原创 2011-04-02 21:04:09 · 95 阅读 · 0 评论 -
自定义uislider 样式
UIImage *stetchLeftTrack= [[UIImage imageNamed:@"UI27.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0]; UIImage *stetchRightTrack = [[UIImage imageNamed:@"UI28.png"] stretchableImageW...原创 2011-04-04 21:28:27 · 159 阅读 · 0 评论 -
[OmniGraffle]iPhone app原型制作工具
在写程序之前,我们通常需要做一些mockup出来(不知道款爷有没有要求同学们在立项的时候写一个程序的preview给他看),特此介绍一个很好的原型和流程绘制的工具:OmniGraffle(http://www.omnigroup.com/applications/OmniGraffle/)。这里有一篇很好的介绍这个程序的文章:http://dingyu.me/blog/posts/view/o...原创 2011-04-06 17:35:32 · 176 阅读 · 0 评论 -
ios NSInvocation简单使用
在ios直接调用某个对象的消息是方法有两种:一:performselector:withObject:二:invocation 第一种方式比较简单,能完成简单的调用。但是对于>2个的参数或者有返回值的处理,那就需要做些额外工作才能搞定。那么在这种情况下,我们就可以使用NSInvocation来进行这些相对复杂的操作 NSInvocation可以处理参数、返回值。会j...原创 2011-12-22 16:39:16 · 74 阅读 · 0 评论 -
ios url缓存策略——NSURLCache、 NSURLRequest
一:url 缓存策略 NSURLRequest requestWithURL:cachePolicy:timeoutInterval: 1:NSURLRequestUseProtocolCachePolicyThis flag will use the underlying protocol’s caching mechanism if the protocols...原创 2011-12-26 17:09:01 · 156 阅读 · 0 评论 -
ios 任务、线程、定时器
一:operations(任务) cocoa提供了三种不同的operations 1:Block operations(NSBlockOperation)These facilitate the execution of one or more block objects. #import <UIKit/UIKit.h>@interface Opera...原创 2011-12-26 18:09:36 · 213 阅读 · 0 评论 -
iOS Open Source : Popover API for iPhone
http://iphonedevelopertips.com/open-source/ios-open-source-popover-api-for-iphone-wepopover.html WEPopover is an API that mirrors UIPopover for the iPad. This class is intentionally designed to ha...原创 2012-01-20 15:02:27 · 100 阅读 · 0 评论 -
sdk3.2手势实例
#import <UIKit/UIKit.h>@interface GesturesViewController : UIViewController {IBOutlet UIImageView *imageView;}@property (nonatomic, retain) UIImageView *imageView;@end #import “Gesture...原创 2011-11-09 10:11:32 · 106 阅读 · 0 评论 -
iphone 对Web Services的三种请求方式soap get post
一:Using SO AP 1.1 POST /iptocountry.asmx HTTP/1.1 Host: www.ecubicle.net Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: “http://www.ecubicle.net/webservices/FindCountr...原创 2011-11-09 10:57:36 · 136 阅读 · 0 评论 -
UIView 和 CALayer的那点事
UIView 和 CALayer的那点事(1)老祖 万物归根,UIView和CALayer都是的老祖都是NSObjet。 1: UIView的继承结构为: UIResponder : NSObject。 可以看出UIView的直接父类为UIResponder 类, UIResponder 是gsm的呢? 官方的解释:The UIResponder ...原创 2012-11-17 23:51:49 · 170 阅读 · 0 评论 -
进阶AlertView运用 - 登入设计
说明:示范如何利用AlertView来制作系统登入的介面程式碼:CustomAlertViewViewController.h #import <UIKit/UIKit.h>//記得加入UIAlertViewDelete@interface CustomAlertViewViewController : UIViewController<UIAl...原创 2011-04-01 17:52:29 · 67 阅读 · 0 评论 -
iPad UIPopoverController弹出窗口的位置和坐标
优化规则: TodoViewController *contentViewController = [[TodoViewController alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewControl...原创 2011-04-01 17:42:20 · 61 阅读 · 0 评论 -
开源项目--twiterfon
twiterfon 原来是基于sdk2.0 的,现在大部分同学都用sdk3.0以上的版本了,直接下载的项目会编译报错,这个是我修正的版本,开源编译运行(模拟器,sdk3.0)...原创 2011-03-22 16:40:54 · 65 阅读 · 0 评论 -
iphone开源项目
前几天看到一位会员,总结了一些开源的IOS项目,我结合自己开发过程中用到的一些开源项目,与大家分享。扫描wifi信息:http://code.google.com/p/uwecaugmentedrealityproject/http://code.google.com/p/iphone-wireless/条形码扫描:http://zbar.sourceforge.net/iphone/sdkdoc...原创 2011-03-25 15:51:34 · 66 阅读 · 0 评论 -
iPhone SDK开发:如何显示WiFi提示
如果你的程序中用到了WiFi,想在没有有效WiFi的时候出现如图所示的提示该怎么做?这个问题被很多人问到过,其实很简单, 只需要在Info.plist中添加如下Key/Value?[Copy to clipboard]View Code CPP 123key name value type valu...原创 2011-03-28 15:48:14 · 65 阅读 · 0 评论