上一页 1 ··· 6 7 8 9 10 11 下一页
  2012年3月27日
摘要: 让Model类遵循NSCoding 和 NSCopying 协议并实现三个方法:- (void)encodeWithCoder:(NSCoder *)encoder {/*[super encodeWithCoder:encoder];//If you are subclassing a class that also conforms to NSCoding, you need to make sure you call encodeWithCoder: on your superclass,*/[encoder encodeObject:foo forKey:kFooKey];[encod 阅读全文
posted @ 2012-03-27 09:57 老Zhan 阅读(469) 评论(0) 推荐(0) 编辑
摘要: 定义两个方法:- (NSString *)dataFilePath;获取返回数据文件的完整路径名- (void)applicationWillResignActive:(NSNotification *)notification;保存数据,参数notification的作用是在对象之间传递通知,保持通信。#define kFilename @"data.plist"- (NSString *)dataFilePath { NSArray *paths = NSSearchPathForDirectoriesInDomains( ... 阅读全文
posted @ 2012-03-27 09:26 老Zhan 阅读(335) 评论(0) 推荐(0) 编辑
摘要: iphone上的数据存储有四种模式:Property lists 属性列表 Object archives (or archiving) 对象归档 SQLite3 (iOS’s embedded relational database) Core Data (Apple’s provided persistence tool)存储中经常需要提取两个相关的目录路径:Documents和tmpGetting the Documents Directory :NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentD... 阅读全文
posted @ 2012-03-27 09:14 老Zhan 阅读(349) 评论(0) 推荐(0) 编辑
  2012年3月26日
摘要: 用Automatic Gesture Recognition实现十分简单- (void)viewDidLoad{ [super viewDidLoad]; UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(doPinch:)]; [self.view addGestureRecognizer:pinch];}- (void)doPinch:(UIPinchGestureRecognizer *)pinch... 阅读全文
posted @ 2012-03-26 11:13 老Zhan 阅读(497) 评论(2) 推荐(0) 编辑
摘要: 用Automatic Gesture Recognition实现:在viewDidLoad中- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self ... 阅读全文
posted @ 2012-03-26 10:43 老Zhan 阅读(681) 评论(0) 推荐(0) 编辑
摘要: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; gestureStartPoint = [touch locationInView:self.view];}- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint currentPosition ... 阅读全文
posted @ 2012-03-26 10:06 老Zhan 阅读(1001) 评论(0) 推荐(0) 编辑
摘要: iphone上的手势操作有许多种,包括轻击、触摸、拖动、轻扫等。开发中与四个方法有很大关联:–touchesBegan:withEvent:–touchesMoved:withEvent:–touchesEnded:withEvent:–touchesCancelled:withEvent:四个方法的参数都是(NSSet *) touches 及(UIEvent *)event。touches 中的每一个对象都是一个UITouch事件。NSUInteger numTaps = [[touches anyObject] tapCount]; NSUInteger numTouches = ... 阅读全文
posted @ 2012-03-26 09:53 老Zhan 阅读(433) 评论(0) 推荐(0) 编辑
  2012年3月25日
摘要: -(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if([elementName isEqualToString:kName_Item]){ [titleData addObject:currentTitleItem]; }else if ([elementName isEqualToString:k... 阅读全文
posted @ 2012-03-25 10:02 老Zhan 阅读(267) 评论(0) 推荐(0) 编辑
摘要: [iPhone]XML文件解析 parsing-xml-files NSXMLParserxml文件解析办法xml是为了提高web数据交换量而出现的,虽然他现在web应用中并不广泛,但是由于他的格式良好,经常被用做配置文件的格式。比如tomcat的主配置文件server.xml,web.xml等等。首先我们看一下需求。我们的目的主要是提取xml文件中的特定内容,又因为xml文件本身的格式良好,这种查询是非常有规律的,非常有利于我们 找到需要的信息。有时我们还可能把特定信息写回xml中,但是这种需求并不是必需的,因为配置文件都不会太大,我们完全可以通过手工办法进行修改。对xml进行解析的标准有两 阅读全文
posted @ 2012-03-25 09:09 老Zhan 阅读(2180) 评论(0) 推荐(0) 编辑
  2012年3月23日
摘要: 第三方函式庫json使用方式以Facebook的Open Graph Protocol為例,首先我們必須先取得JSON字串:NSURL *url = [NSURL URLWithString:@"http://graph.facebook.com/cyberbuzz"];NSString *JSONString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];再來便是呼叫json-framework所提供的方法來解析字串,將解析的結果儲存在NSDictionar 阅读全文
posted @ 2012-03-23 00:12 老Zhan 阅读(490) 评论(0) 推荐(0) 编辑
  2012年3月22日
摘要: A---》B想把数据 NSString A_data 从AController传到BController,则在BController中 @property 一个NSString data ,然后在AController中添加方法- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ UIViewController *destination = segue.destinationViewController; if ([destination respondsToSelector:@select... 阅读全文
posted @ 2012-03-22 16:30 老Zhan 阅读(5795) 评论(1) 推荐(0) 编辑
  2012年3月20日
摘要: - (BOOL)respondsToSelector:(SEL)aSelector Returns a Boolean value that indicates whether the receiver implements or inherits a method that can respond to a specified message. (required)Paraments:aSelector: A selector that identifies a message.Return:YES if the receiver implements or inherits a meth. 阅读全文
posted @ 2012-03-20 21:39 老Zhan 阅读(277) 评论(0) 推荐(0) 编辑
  2012年3月18日
摘要: story board是xcode4.2新增的一个特性,它将原有工程中的所有xib文件集成在一起,用拖拽的方式建立2个viewController之间的跳转关系,使得整个程序的UI跳转逻辑清楚明了。使用storyboard后,界面相关的代码编写将更少。 简单说一个storyboard是个什么东西。storyboard引入了2个概念: scene: 一个场景, 由一个viewController和相关的xib表示 segue: ['seiɡwei] n. 继续,持续。用于连接scenes,segue有多种类型,包括: Push, Modal, Popover and more segue 阅读全文
posted @ 2012-03-18 01:12 老Zhan 阅读(876) 评论(0) 推荐(0) 编辑
  2012年3月17日
摘要: http://www.cocoachina.com/bbs/read.php?tid-21072.html 阅读全文
posted @ 2012-03-17 00:35 老Zhan 阅读(125) 评论(0) 推荐(0) 编辑
  2012年3月15日
摘要: UITableViewDataSource Protocol(https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewDataSource_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006941)required method:–tableView:cellForRowAtIndexPath: –tableView:numberOfRowsInSection:UITableViewDelega... 阅读全文
posted @ 2012-03-15 00:53 老Zhan 阅读(188) 评论(0) 推荐(0) 编辑
  2012年3月12日
摘要: Couldn't register com.gdou.zhy.zhysimpleTable with the bootstrap server. Error: unknown error code.This generally means that another instance of this process was already running or is hung in the debugger.解决:重启系统。 阅读全文
posted @ 2012-03-12 11:07 老Zhan 阅读(1730) 评论(0) 推荐(0) 编辑
  2012年3月8日
摘要: 建一个Single View Application的project。部分代码:#import <UIKit/UIKit.h>@interface BIDViewController : UIViewController@property (strong, nonatomic) IBOutlet UITextField *nameField;@property (strong, nonatomic) IBOutlet UITextField *numberField;- (IBAction)textFieldDoneEditing:(id)sender;//为了Done时退出键盘- 阅读全文
posted @ 2012-03-08 14:21 老Zhan 阅读(311) 评论(0) 推荐(0) 编辑
摘要: #import <UIKit/UIKit.h>@class BIDViewController;@interface BIDAppDelegate : UIResponder <UIApplicationDelegate>@property (strong, nonatomic) UIWindow *window;@property (strong, nonatomic) BIDViewController *viewController;@end#import "BIDAppDelegate.h"#import "BIDViewContr 阅读全文
posted @ 2012-03-08 11:16 老Zhan 阅读(318) 评论(0) 推荐(0) 编辑
摘要: strong关键字与retain关似,用了它,引用计数自动+1,用实例更能说明一切@property(nonatomic,strong)NSString*string1; @property(nonatomic,strong)NSString*string2; 有这样两个属性,@synthesizestring1; @synthesizestring2; 猜一下下面代码将输出什么结果?self.string1=@"String1"; self.string2=self.string1; self.string1=nil; NSLog(@"String2=%@&qu 阅读全文
posted @ 2012-03-08 10:53 老Zhan 阅读(24507) 评论(11) 推荐(3) 编辑
  2012年3月7日
摘要: 1.Application:在这个类别下面,你可以看到下面8种可选类型下面对这些工程一一说明:1.Document-Based Application:工程缺省说明如下:This template provides a starting point for a document-based application. It provides an interface to store documents locally or in iCloud.这个就是iOS新增的一个重要功能--云计算的一个体现,你可以创建一个基于Master-Detail Application类型的工程,不过加入了一个文档 阅读全文
posted @ 2012-03-07 16:47 老Zhan 阅读(238) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 下一页