
iPhone开发
文章平均质量分 84
ColorPaper
游侠
展开
-
判断NSString是否为数字
<br /><br />IPhone之判断是否为数字<br /> <br />源自:http://blog.sina.com.cn/s/blog_4adf31ea0100nw3t.html<br /> <br />判断是否为整形:<br /> <br /> <br />- (BOOL)isPureInt:(NSString *)string{<br />NSScanner* scan = [NSScanner scannerWithString:string]; <br />int val; <br />r转载 2011-05-10 16:44:00 · 2247 阅读 · 0 评论 -
在iphone应用程序中启动其他应用程序
<br />Launching Other Apps within an iPhone ApplicationPosted on October 26, 2008 by Rodney Aiglstorfer in Cocoa<br /><br />In an earlier post I talked about how to launch the browser from within an iPhone application using theUIApplication:openURL: method转载 2011-05-09 10:29:00 · 1214 阅读 · 0 评论 -
由viewWillAppear没有被调用见控制器结构设计上的误区
<br /><br />问题<br /> <br />Hi,<br />I'm stuck! I can't see why viewWillAppear doesn't run in my code but viewDidLoad runs. If I understand it correctly viewDidLoad runs once on the first instance and viewWillAppear runs every time a view is added to the st原创 2011-05-12 14:37:00 · 1083 阅读 · 0 评论 -
View Controller Basics
<br />View Controller Basics<br />View controllers provide the fundamental infrastructure you need to implement iOS applications. This chapter provides an overview of the role view controllers play in your application and how you use them to implement diff转载 2011-05-12 15:03:00 · 989 阅读 · 0 评论 -
如何阻断用户操作界面
<br /> 在iOS程序设计中,往往需要暂时阻断用户操作界面。比如,用户点击了某个按钮后,需要执行一些操作,在这些操作的执行过程中,我们不想让用户操作界面,以避免发生冲突,所以就需暂时阻断用户操作界面。下面是实现这种功能的方法:<br /> <br /> <br />//******************UserInterfaceBlock.h****************************<br /> <br />#import <Foundation/Foundation.h><b原创 2011-05-12 17:00:00 · 1009 阅读 · 0 评论 -
viewWillAppear, viewDidAppear not being called, not firing
源自:http://www.readmespot.com/question/o/3560669/viewwillappear--viewdidappear-not-being-called--not-firing<br /> viewWillAppear, viewDidAppear not being called, not firing1<br />(This is both question and answer since it took quite a bit of digging to fin转载 2011-05-20 08:18:00 · 1655 阅读 · 0 评论 -
Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default key
<br /><br />源自:博客园 <br />Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default key<br /> <br />1.直接Build and run,找不到SDK 2.0<br />打开工程, 在菜单中选择Projects, General标签中的最下面有一个<br />Base SDK for All转载 2011-05-21 15:47:00 · 2108 阅读 · 0 评论 -
mac os x 下面怎么截屏
<br />cmdmand+shift+3截取全屏cmdmand+shift+4截取部分,点击鼠标左键,选取要截图的区域cmdmand+shift+4截取对话框、窗口,在要截图的窗口按空格,点鼠标左键操作后,到桌面找刚刚的截图文件吧,默认情况下,输入格式为PNG。转载 2011-05-20 14:01:00 · 1068 阅读 · 0 评论 -
获取NSString子字符串
<br />NSString类中提供了这样三个方法用于获取子字符串:<br />– substringFromIndex:– substringWithRange:– substringToIndex:<br />它们该怎么使用呢?见下面代码即可知道。<br /> <br /><br />NSString *str = @"12345";<br /> <br />//NSString *subString0 = [str substringFromIndex:-1]; //会放生越界错误<br />NS原创 2011-05-21 13:38:00 · 17032 阅读 · 1 评论 -
iPhone 多线程
<br />来源:转载(网友发布) <br /> <br />iPhone 多线程<br /> 多线程在各种编程语言中都是难点,很多语言中实现起来很麻烦,objective-c虽然源于c,但其多线程编程却相当简单,可以与java相媲美。这篇文章主要从线程创建与启动、线程的同步与锁、线程的交互、线程池等等四个方面简单的讲解一下iphone中的多线程编程。<br /> 一、线程创建与启动<br /> 线程创建主要有二种方式:<br /> - (id)init; // designated initial转载 2011-05-21 15:19:00 · 751 阅读 · 0 评论 -
再谈阻断用户界面
<br /><br />源自:http://stackoverflow.com/questions/1697029/ignoring-ui-events-in-appkit<br /> <br />if I wanted to ignore a touch event in UIKit on the iPhone I would simply do:// Begin ignoring events<br />[[UIApplication sharedApplication] beginIgnoringIn转载 2011-05-29 01:27:00 · 928 阅读 · 0 评论 -
NSData和UIImage之间的转换
<br /><br />源自:http://stackoverflow.com/questions/2240765/nsdata-to-uiimage<br /> <br />Try this code. This worked for me.<br />create path to save the image data.NSArray*pathArr =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,<br />转载 2011-05-30 10:48:00 · 16049 阅读 · 0 评论 -
如何将MFMailComposeViewController的发送邮件界面设为中文
<br />如何将MFMailComposeViewController的发送邮件界面设为中文?解决方法:将plist中的Localization native development region 设为china即可原创 2011-05-31 18:58:00 · 1517 阅读 · 0 评论 -
Asset Libraries and Blocks in iOS 4
<br /> <br />源自:http://www.icodeblog.com/2010/07/08/asset-libraries-and-blocks-in-ios-4/<br /> <br />iOS 4 presented a million billion new API’s by Apple’s count, but for this post I am going to show a quick demo of the new Assets Library API where you can转载 2011-06-01 11:26:00 · 1003 阅读 · 0 评论 -
iPhone/iPad收发网易163/126邮箱邮件设置
<br />来源:iPhone中文网<br /> <br />网易邮箱的IMAP服务更核心的在于“极速”收取邮件。IMAP提供的摘要浏览功能可以让你在阅读完所有的邮件到达时间、主题、发件人、大小等“摘要”信息后再作出是否下载整封邮件或附件的决定。一封20M附件的商业信函,标题和摘要仅2K大小,如使用IMAP,邮件收取速度提升10倍以上。这对使用iPhone4或iPad的用户来说,不仅节省流量,而且实现了办公智能化。 <br /> <br /> 需要提醒的是,如果不是用客户端接收邮件,当用户使用转载 2011-05-31 18:42:00 · 4640 阅读 · 0 评论 -
如何禁止UIWebView滚动和回弹
<br /><br />for (id subview in webView.subviews){ //webView是要被禁止滚动和回弹的UIWebView<br />if ([[subview class] isSubclassOfClass: [UIScrollViewclass]])<br />((UIScrollView *)subview).scrollEnabled = NO;<br />}原创 2011-05-31 21:35:00 · 6295 阅读 · 0 评论 -
去除NSString字符串的前后空格和换行符
<br />NSString *trimText = [text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]原创 2011-06-01 16:46:00 · 2037 阅读 · 0 评论 -
IPhone之UIProgressView
<br /><br />源自:http://hi.baidu.com/aidfan/blog/item/014e5d0ecc6b15de7acbe17e.html<br /> <br />做了一个小Deme,是通过UIActionSheet来显示UIProgressView进度条的。<br /> <br /> <br />代码如下:<br /> <br />@interface View21 : UIViewController <UIActionSheetDelegate><br />{<br />flo转载 2011-04-12 20:25:00 · 1060 阅读 · 0 评论 -
UIViewController内存管理相关的几个方法
<br />dealloc<br />Deallocates the memory occupied by the receiver.- (void)deallocDiscussion<br />Subsequent messages to the receiver may generate an error indicating that a message was sent to a deallocated object (provided the deallocated memory hasn’t b转载 2011-04-13 16:27:00 · 878 阅读 · 0 评论 -
利用NSThread创建新线程
<br /> detachNewThreadSelector:toTarget:withObject:<br />Detaches a new thread and uses the specified selector as the thread entry point.+ (void)detachNewThreadSelector:(SEL)aSelector toTarget:(id)aTarget withObject:(id)anArgumentParametersaSelector<br />T转载 2011-04-13 23:53:00 · 856 阅读 · 0 评论 -
NSValue和NSNumber的作用和关系
NSValueAn NSValue object is a simple container for a single C or Objective-C data item. It can hold any of the scalar types such as int, float, and char, as well as pointers, structures, and object ids. The purpose of this class is to allow items of such d转载 2011-04-14 00:09:00 · 1105 阅读 · 0 评论 -
Some Tips In Object C
<br /> <br /><br />源自:http://blog.youkuaiyun.com/kmyhy/archive/2010/07/06/5716755.aspx<br /> <br />1.使用class获得meta class<br />NSLog (@"Class name : %@",[[[arr objectAtIndex:i] class] description]);<br />2.使用NSClassFromString和 NSSelectorFromString<br />id object转载 2011-04-11 21:48:00 · 1058 阅读 · 0 评论 -
Program received signal: “0”
<br /><br />Question:<br />Hi all,<br />I'm working on an iPad app that downloads a CSV file from the web and parses the file into a NSMutableArray. (I'm using the code from http://www.macresearch.org/cocoa-scientists-part-xxvi-parsing-csv-data suggested i转载 2011-04-13 15:55:00 · 1213 阅读 · 0 评论 -
Objective-C内存管理知识总结
<br />作者 dboylx<br /><br />原帖地址 http://www.cocoachina.com/bbs/read.php?tid-12760.html<br /><br />Objective-C的内存管理机制是比较灵活的,即可以拿来像C/C++一样用,也可以加个AutoreleasePool让它升级为半自动化的内存管理语言。当然,也不能拿JAVA虚拟机中的全自动化GC来比?<br /><br />一,引用计数是实例对象的内存回收唯一参考<br />引用计数(retainCount)转载 2011-04-13 19:56:00 · 526 阅读 · 0 评论 -
慎用dictionaryWithObjectsAndKeys方法
<br /><br />源自:http://blog.youkuaiyun.com/kmyhy/archive/2010/12/17/6082394.aspx<br /> <br />有这样一段代码:<br />NSDictionary* items2=[NSDictionary dictionaryWithObjectsAndKeys:<br /> [d objectForKey:@"GZDBH"],@"工作单编号",<br /> [d objectForKey:@"LDSJ"],@"来电时间",<br />转载 2011-04-11 22:42:00 · 543 阅读 · 0 评论 -
how to debug EXC_BAD_ACCESS on iPhone
源自:http://apps.hi.baidu.com/share/detail/24675911 how to debug EXC_BAD_ACCESS on iPhoneEXC_BAD_ACCESS. Debugging this one is on par with figuring out why the wife says “not tonight, honey.”转载 2011-06-03 10:55:00 · 713 阅读 · 0 评论 -
UIImagePickerController在iPhone和iPad中用法的一点不同
<br /><br />源自:http://huchenqiang90.blog.163.com/blog/static/1125008002011018416051/<br /><br /><br />我们知道,在iPhone中获取照片库常用的方法如下:<br />UIImagePickerController *m_imagePicker = [[UIImagePickerController alloc] init];<br /> if ([UIImagePickerController isS转载 2011-06-01 10:17:00 · 1059 阅读 · 0 评论 -
如何往ios模拟器中添加照片
<br />如何往ios模拟器中添加照片作者:yampaking<br /> <br /> 看到得最简单得方法是:直接把照片拖到ios模拟器上,ios模拟器会自动使用safari打开,用鼠标左/右键长按ios模拟器屏幕,出现窗口,点击“保存”即可自动保存到ios模拟器的照片库中。 <br /> 注意:鼠标左右键可能不同,论坛上有人只可用左键,右键无反应。而我的左键长按后能够弹出窗口,但是保存后没反应,右键反而可以。 <br /> <br /> 另外,还有一个专业的方法,采用程序的方法转载 2011-06-01 14:12:00 · 1646 阅读 · 0 评论 -
在 App 里发送带附件 Email 的实现代码
<br />源自:http://www.cocoachina.com/iphonedev/sdk/2010/0528/1572.html在 App 里发送带附件 Email 的实现代码想在iPhone App里添加能发送附件的Email功能。可以加入messageUI.framework<br /><br />添加附件代码<br />NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask转载 2011-06-01 15:52:00 · 710 阅读 · 0 评论 -
CALayer Animatable Properties
源自:iOS SDK文档 CALayer Animatable PropertiesThe following CALayer class properties can be animated by Core Animation. See CALayer for more information.anchorPoint Uses the default impl转载 2011-06-05 17:24:00 · 766 阅读 · 0 评论 -
Key-Value Coding; Key-Value Observing
Chapter 7. Key-Value Coding; Key-Value Observing摘自:《Cocoa Programming for Mac OS X, 3rd》 作者:Aaron Hillegass Key-value coding (KVC) is a mechanism that allows you to set and get the val转载 2011-06-05 20:15:00 · 776 阅读 · 0 评论 -
CATransform3DMakeRotation的x,y,z参数
CATransform3DMakeRotation的x,y,z参数 The following example creates a transformation for the purpose of rotating a layer: CATransform3D myTransform; myTransform = CATransform3DMakeRotation(angle转载 2011-06-06 11:53:00 · 2432 阅读 · 0 评论 -
CALayer的anchorPoint属性与transform属性
CALayer的anchorPoint属性与transform属性 When you apply a transform to a layer, the transform uses the anchor point to determine where to rotate, scale, and so on.With the examples so far, the sca转载 2011-06-06 11:59:00 · 1449 阅读 · 0 评论 -
iphone viewWillAppear not firing
iphone viewWillAppear not firingIve read numerous posts about people having problems with viewWillAppear when you do not create your view heirarchy JUST right. My problem is I cant figure out wh转载 2011-06-06 21:45:00 · 806 阅读 · 0 评论 -
第三方SQLITE封装库pldatabase的介绍
<br />源自:http://aminby.net/2010/08/iphone-sqlite-pldatabase-introduce/引文<br />花了三周时间,把原来使用原生SqliteAPI写的代码都改成了PLSqliteDatabase的操作.<br />下载解压后把framework导入到项目中. 项目中需要sqlite.dylib,不然无法链接成功.<br />pldatabase的网站地址:http://plsqlite.narod.ru/http://code.google.com/p转载 2011-04-15 19:01:00 · 1120 阅读 · 0 评论 -
iPhone: There is no SDK with the name or path 'iphoneos3.0'
<br />iPhone: There is no SDK with the name or path 'iphoneos3.0'<br />解决方法:<br />Tell me about it. Try this in XCode goto 'Project' Menu and select 'Edit Project Settings'. In the General tab, last but one item, select the drop down list 'Base SDK for all转载 2011-04-17 14:04:00 · 672 阅读 · 0 评论 -
NSString和NSDate之间的相互转换
NSString to NSDateNSString*dateString =@"01-02-2010";NSDateFormatter*dateFormatter =[[NSDateFormatter alloc] init];// this is imporant - we set our input date format to match our input string// if format doesn't match you'll get nil from your string, so be转载 2011-04-17 18:27:00 · 1026 阅读 · 0 评论 -
iphone上下左右手势判断代码
源自:http://www.feni.cn/ArticlesDetails.aspx?ArticlesId=86 //四个方向手势引发不同程序响应-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer { NSLog(@"Swipe received."); self.uid = [[UIDev转载 2011-06-07 17:21:00 · 1231 阅读 · 0 评论 -
UINavigationController and viewWillAppear / viewDidAppear
源自:http://www.idev101.com/code/User_Interface/UINavigationController/viewWillAppear.html When you push or pop a view controller on/off a navigaction controllers stack, the usual viewWillAppear转载 2011-06-06 21:47:00 · 613 阅读 · 0 评论 -
用UIGestureRecognizer侦测使用者输入
源自:http://www.cocoachina.com/iphonedev/sdk/2010/1214/2471.html 用UIGestureRecognizer侦测使用者输入操作 在3.2以前,我们要拿到UITouch跟使用者互动,大部分都是透过UIResponder的四种methods - (void)touchesBegan:(NSSet *)touches with转载 2011-06-07 17:37:00 · 1063 阅读 · 0 评论