代码改变世界

随笔档案-2010年08月

介绍两种常用的XML解析方式(NSXMLParser & GDataXMLNode)

2010-08-29 21:40 by Tracy E, 3543 阅读, 收藏,
摘要: 介绍两种常用的XML解析方式(NSXMLParser & GDataXMLNode)常用的解析XML的方式分为两种,它们基于不同的API:1.Tree-based API:这种API的处理方式是将XML的结构看成是树,然后把树的各部分看成一个对象来处理,这就是我们说的DOM (Document Object Model)方式。在iPhone的SDK里包含了一个libxml2的框架(Fram... 阅读全文

如何选择你的iPhone XML解析器

2010-08-27 10:59 by Tracy E, 1350 阅读, 收藏,
摘要: XMLPerformance测试应用程序扩展到比较第三方库有很多选择,当谈到关于iPhone的XML解析。在iPhone SDK中配有两个不同的库可供选择,并有几种流行的资料,例如TBXML,TouchXML,KissXML,TinyXML的第三方库和GDataXML。发展商如何选择?最近我一直在考虑了各种选择在那里寻找,并最终延长苹果XMLPerformance样品试用上述各图书馆,了解他们如何... 阅读全文

在程序的ICON上显示数字

2010-08-23 11:48 by Tracy E, 722 阅读, 收藏,
摘要: 前几天有童鞋问我怎样在程序的ICON上显示数字,当时没多想——“不清楚”。 今天回想起来,觉得应该是UIApplication的一个属性,就查了下API,果然找到了这个属性:@property(nonatomic) NSInteger applicationIconBadgeNumber;// set to 0 to hide. default is... 阅读全文

iphone开发笔记(三)

2010-08-21 20:35 by Tracy E, 1375 阅读, 收藏,
摘要: 自定义NavigationBar navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; [navigationBar setBarStyle:UIBarStyleBlackOpaque]; myNavigationItem = [[UINavigationItem alloc] in... 阅读全文

Opening Files Whose Type is Unknown

2010-08-15 20:45 by Tracy E, 565 阅读, 收藏,
摘要: Opening Files Whose Type is Unknown (UIDocumentInteractionController)How to use a document interaction controller:1.Create an instance of the UIDocumentInteractionController class for each file you wa... 阅读全文

在ToolBar上添加SegmentedControl

2010-08-13 20:45 by Tracy E, 856 阅读, 收藏,
摘要: 学习iphone这么长时间,还没怎么用过ToolBar,今天项目需求,要用到它。本以为很容易用,结果发现想在ToolBar上添加一个segmentedControl就把我难住了一下下。 ToolBar上所有的Items都必须是UIBarButtonItem类型的,因此需要先把SegmentedControl转变成UIBarButtonItem才能加上去。toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 372, 320, 44)];UIBarButtonItem *todayItem = [[UIBarButtonItem ... 阅读全文

The View management cycle

2010-08-11 21:00 by Tracy E, 302 阅读, 收藏,
摘要: Load cycle1 Some part of your application asks for the view in controller's View property.2 If the view is not currently in memory, the view controller calls its loadView method.3 The loadView method ... 阅读全文

获取本地相册或调用相机

2010-08-11 20:51 by Tracy E, 833 阅读, 收藏,
摘要: - (void) addPicEvent{ //先设定sourceType为相机,然后判断相机是否可用(ipod)没相机,不可用将sourceType设定为相片库 UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; if (![UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { sourceType = UIImageP... 阅读全文

视图控制器之间的切换

2010-08-11 20:36 by Tracy E, 781 阅读, 收藏,
摘要: 两个UIView之间的翻转可以用动画效果翻转(上下,左右) UIViewController之间的切换除了UINavigationController里面的pushViewController和popViewController与UITalbarController在viewControllers之间的切换外, 我们还可以在其他地方自由的进行ViewController切换:MyViewContr... 阅读全文

SQLite之SQL语言

2010-08-11 20:30 by Tracy E, 533 阅读, 收藏,
摘要: --==========================---- 如果存在Classes表,则删除该表DROP TABLE IF EXISTS [Classes];-- 创建Classes表CREATE TABLE [Classes]( [ID] INTEGER PRIMARY KEY, -- 班级编号,主键 [Name] STRING NULL DEFAULT '' -- 班级名称);-- 添... 阅读全文

iphone开发笔记(二)

2010-08-06 20:04 by Tracy E, 1064 阅读, 收藏,
摘要: NavigationController 推出push 推出pop[self.navigationControllerpushViewController:_detailControlleranimated:YES];[self.navigationControllerpopViewControllerAnimated:YES];Debug:NSLog(@"%s %d", __FUNCTION__, __LINE__);纯代码时,点击textField外的地方回收键盘:先定义一个UIControl类型的对象,在上面可以添加触发事件,令SEL实践为回收键盘的方法,最后将UIC 阅读全文

UITableView和UIPickerView的Delegate和DataSource

2010-08-05 19:34 by Tracy E, 2263 阅读, 收藏,
摘要: UITableViewController<UITableViewDelegate, UITableViewDataSource>@protocol UITableViewDelegate<NSObject, UIScrollViewDelegate>@optional// Display customization- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;// 阅读全文