10 2013 档案

摘要:检查- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;返回结果 阅读全文
posted @ 2013-10-28 10:05 时光独白 阅读(204) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/2156015/remove-all-subviews 阅读全文
posted @ 2013-10-24 12:40 时光独白 阅读(343) 评论(0) 推荐(0)
摘要:原文地址:http://blog.csdn.net/xiaotanyu13/article/details/7711954iOS上面对键盘的处理很不人性化,所以这些功能都需要自己来实现,首先是点击return和屏幕隐藏键盘这个首先引用双子座的博客http://my.oschina.net/plumsoft/blog/42545,他的文章写的很好,对大家的理解很有好处。在 iOS 程序中当想要在文本框中输入数据,轻触文本框会打开键盘。对于 iPad 程序,其键盘有一个按钮可以用来关闭键盘,但是 iPhone 程序中的键盘却没有这样的按钮,不过我们可以采取一些方法关闭它。例如,我们可以实现按下 R 阅读全文
posted @ 2013-10-22 17:38 时光独白 阅读(429) 评论(0) 推荐(0)
摘要:方法一:http://blog.csdn.net/xiaotanyu13/article/details/7711954因为屏幕太小的缘故,一个键盘跳出来总是把输入框挡住,所以需要移动屏幕来匹配键盘#pragma mark -#pragma mark解决虚拟键盘挡住UITextField的方法- (void)keyboardWillShow:(NSNotification*)noti{ //键盘输入的界面调整 //键盘的高度 floatheight = 216.0; CGRectframe =self.view.frame; frame.size=CGSize... 阅读全文
posted @ 2013-10-22 17:35 时光独白 阅读(510) 评论(0) 推荐(0)
摘要:http://site.douban.com/129642/widget/notes/5513129/note/187701199/压入:[menuController popViewController:controller animated:YES];弹出:[self.navigationController popToRootViewControllerAnimated:YES]; 阅读全文
posted @ 2013-10-22 17:00 时光独白 阅读(203) 评论(0) 推荐(0)
摘要:从服务器获取的json数据,通过调用dictionary中的objectForKey方法,返回的是一个id类型数据,需要比较这个数据是否为0,所以需要转化成NSInteger方法:NSInteger questionId = [[newQuestion objectForKey:@"question_id"] integerValue];http://stackoverflow.com/questions/6474679/objective-c-convert-id-to-nsinteger 阅读全文
posted @ 2013-10-22 16:43 时光独白 阅读(726) 评论(0) 推荐(0)
摘要:1. [password setSecureTextEntry:YES];2. 在XIB中拖入一个 TextField ,在Attributes Inspecter 中把 Secure 那个chekbox给勾上 阅读全文
posted @ 2013-10-22 16:36 时光独白 阅读(321) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/4445173/when-to-use-nsinteger-vs-int 阅读全文
posted @ 2013-10-22 16:12 时光独白 阅读(156) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/zhuqil/archive/2011/08/03/21265241、判断字符串是否相等使用isEqualToString: NSString *astring01 = @"This is a String!"; NSString *astring02 = @"This is a String!"; BOOL result = [astring01 isEqualToString:astring02]; NSLog(@"result:%d",result);2、判断字符不相等:NSStri 阅读全文
posted @ 2013-10-22 15:47 时光独白 阅读(323) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/wujian1360/archive/2011/09/05/2167992.html 阅读全文
posted @ 2013-10-21 09:28 时光独白 阅读(123) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/13567455/property-count-not-found-on-object-of-type-nsmutablearray-po-command-in-ll 阅读全文
posted @ 2013-10-20 18:24 时光独白 阅读(448) 评论(0) 推荐(0)
摘要:http://blog.sina.com.cn/s/blog_55f899fb0102dqi2.html 阅读全文
posted @ 2013-10-18 17:38 时光独白 阅读(226) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/elfsundae/archive/2010/11/30/1892544.html 阅读全文
posted @ 2013-10-18 17:37 时光独白 阅读(150) 评论(0) 推荐(0)
摘要:http://www.cocoachina.com/bbs/read.php?tid=62704重启解决 阅读全文
posted @ 2013-10-18 16:35 时光独白 阅读(296) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/totogo2010/article/details/7669837 阅读全文
posted @ 2013-10-18 16:03 时光独白 阅读(99) 评论(0) 推荐(0)
摘要:http://mobile.51cto.com/iphone-392479.htm 阅读全文
posted @ 2013-10-18 15:27 时光独白 阅读(137) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/12328026/how-to-remove-all-references-for-outlet 阅读全文
posted @ 2013-10-17 15:40 时光独白 阅读(172) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/446405/adjust-uilabel-height-depending-on-the-text根据内容动态设置UILabel高度 阅读全文
posted @ 2013-10-17 13:00 时光独白 阅读(135) 评论(0) 推荐(0)
摘要:原文地址:http://blog.csdn.net/likendsl/article/details/7566305我们做iOS程序开发时经常用遇到EXC_BAD_ACCESS错误导致Crash,出现这种错误时一般Xcode不会给我们太多的信息来定位错误来源,只是在应用Delegate上留下像Thread 1: Program received signal:"EXC_BAD_ACCESS",让问题无从找起。比如你对已释放的对象发送消息时就会出现,EXC_BAD_ACCESS,再如release的对象再release,release那些autorelease的对象等也会报这 阅读全文
posted @ 2013-10-17 10:07 时光独白 阅读(331) 评论(0) 推荐(0)
摘要:原文地址:http://www.cnblogs.com/ygm900/p/3154747.html有没有遇到过,导航+UITableView,在push,back回来之后,当前cell仍然是选中的状态。当然,解决办法简单,添加一句[tableView deselectRowAtIndexPath:indexPath animated:YES]即可。令人纠结的时,在没加这句的时候,有的视图同样回来之后,选中状态消失,为什么会出现这种情况呢?原来是,如果UITableView是在UITableViewController中时,就会默然取消,而如果是在UIViewController时,需要添加这一 阅读全文
posted @ 2013-10-17 09:01 时光独白 阅读(291) 评论(0) 推荐(0)
摘要:原文地址:http://blog.sina.com.cn/s/blog_76f3236b01013zmk.html1、CGRectInsetCGRect CGRectInset (CGRect rect,CGFloat dx,CGFloat dy);该结构体的应用是以原rect为中心,再参考dx,dy,进行缩放或者放大。图中的每一个矩形都是以上一个矩形作为参考矩形。所以下一矩形(比如黄色矩形对绿色矩形来说是下一个矩形)都比上一个矩形要小。具体小多少都是要参照dx和dy来判定的。2、CGRectOffsetCGRect CGRectOffset(CGRect rect,CGFloat dx,CG 阅读全文
posted @ 2013-10-16 17:29 时光独白 阅读(375) 评论(0) 推荐(0)
摘要:通过设置行高,确定上下间距- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath设置frame,通过坐标设置左右间距[pic setFrame:CGRectMake(230, 0, 73, 53)]; 阅读全文
posted @ 2013-10-16 17:27 时光独白 阅读(379) 评论(0) 推荐(0)
摘要:http://www.cocoachina.com/bbs/simple/?t31769.htmlUITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; UILabel *tempLable=(UILabel *)[cell viewWithTag:1]; UIImageView *tempImage=(UIImageView *)[cell viewWithTag:2]; CGFloat lableHeight=tempLable.frame.size.heigh... 阅读全文
posted @ 2013-10-16 17:06 时光独白 阅读(166) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/11847515/set-uiimageview-size-in-uitableviewcell-when-uiimage-loaded-from-url 阅读全文
posted @ 2013-10-16 16:54 时光独白 阅读(133) 评论(0) 推荐(0)
摘要:UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(10, 100, 300, 180)]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 150)]; label.text = @"where are you? where are you? where are you? where are you? where are you? where are you? where are you? where a... 阅读全文
posted @ 2013-10-16 16:31 时光独白 阅读(278) 评论(0) 推荐(0)
摘要:原文地址:http://blog.csdn.net/enuola/article/details/8559588在大多属性情况下,给UILabel进行动态数据绑定的时候,往往需要根据字符串的多少,动态调整UILabel的宽度或高度。下面分两种情况考虑:1、UILabel宽度不变,根据字体多少,自动调整UILabel的高度,并折行显示。代码如下:[cpp]view plaincopyUILabel*label=[[UILabelalloc]initWithFrame:CGRectMake(0,10,200,20)];label.font=[UIFontboldSystemFontOfSize:2 阅读全文
posted @ 2013-10-16 16:19 时光独白 阅读(240) 评论(0) 推荐(0)
摘要:NSURL*url = [NSURLURLWithString:@“http.....”]; UIImage*image = [UIImageimageWithData:[NSDatadataWithContentsOfURL:url]]; uiimage.image= image; 阅读全文
posted @ 2013-10-15 16:23 时光独白 阅读(349) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/12914788/uilinebreakmodewordwrap-is-deprecated 阅读全文
posted @ 2013-10-15 16:07 时光独白 阅读(493) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/8460340/interface-type-cannot-be-statically-allocated 阅读全文
posted @ 2013-10-15 11:45 时光独白 阅读(676) 评论(0) 推荐(0)
摘要:1. NSString转换成NSDataNSString* str = @"teststring";NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding];2. NSData转换成NSStringNSString *aString = [[NSString alloc] initWithData:adataencoding:NSUTF8StringEncoding];3. JSON格式的NSString转换成NSMutableDictionaryNSError *err = nil;NSArray *arr = 阅读全文
posted @ 2013-10-15 11:44 时光独白 阅读(614) 评论(0) 推荐(0)
摘要:http://blog.sina.com.cn/s/blog_71715bf801016d38.html 阅读全文
posted @ 2013-10-14 19:03 时光独白 阅读(378) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/10296138/xcode-debug-shortcuts 阅读全文
posted @ 2013-10-14 18:48 时光独白 阅读(157) 评论(0) 推荐(0)
摘要:网上搜到一些答案,但都没解决,后来发现是因为build phases中忘记添加对应的.m文件了 :) 阅读全文
posted @ 2013-10-14 15:38 时光独白 阅读(159) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/12447725/afnetworking-and-post-request产生该错误的原因是AFNetworking默认不接收该类型,根据错误信息里面的提示,添加代码[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObject:@"text/html"]];text/html根据自己的错误写 阅读全文
posted @ 2013-10-14 14:55 时光独白 阅读(616) 评论(0) 推荐(1)
摘要:原文地址:http://blog.sina.com.cn/s/blog_71715bf80101a9q6.htmlARC是什么ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting)。简单地说,就是代码中自动加入了retain/release,原先需要手动添加的用来处理内存管理的引用计数的代码可以自动地由编译器完成了。该机制在 iOS 5/ Mac OS X 10.7 开始导入,利用 Xcode4.2 可以使用该机制。简单地理解ARC,就是通过指定的语法,让编译器(LLVM 3.0)在编译代码时,自动生成实例的引用计数管理部分代码。有一点,AR 阅读全文
posted @ 2013-10-12 18:28 时光独白 阅读(209) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/12451084/afnetworking-in-arc-gives-compiler-warnings-after-adding-fno-obc-arc 阅读全文
posted @ 2013-10-12 18:27 时光独白 阅读(395) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/10119239/adding-reachability-class-fails-when-i-am-trying-to-build 阅读全文
posted @ 2013-10-12 11:00 时光独白 阅读(531) 评论(0) 推荐(0)
摘要:原文地址:http://blog.csdn.net/ranxiedao/article/details/8214936今天使用Fragment的时候,出现了这个错误IllegalStateException: Can not perform this action after onSaveInstanceState:E/AndroidRuntime(12747):Causedby:java.lang.IllegalStateException:CannotperformthisactionafteronSaveInstanceStateatandroid.support.v4.app.Frag 阅读全文
posted @ 2013-10-10 15:09 时光独白 阅读(246) 评论(0) 推荐(0)
摘要:原文地址:http://www.infoq.com/cn/articles/afn_vs_asi在开发iOS应用过程中,如何高效的与服务端API进行数据交换,是一个常见问题。一般开发者都会选择一个第三方的网络组件作为服务,以提高开发效率和稳定性。这些组件把复杂的网络底层操作封装成友好的类和方法,并且加入异常处理等。那么,大家最常用的组件是什么?这些组件是如何提升开发效率和稳定性的?哪一款组件适合自己,是 AFNetworking(AFN)还是 ASIHTTPRequest(ASI)?几乎每一个iOS互联网应用开发者都会面对这样的选择题,要从这两个最常用的组件里选出一个好的还真不是那么容易。单单 阅读全文
posted @ 2013-10-09 09:43 时光独白 阅读(203) 评论(0) 推荐(0)
摘要:原文地址:http://bj007.blog.51cto.com/1701577/649413无论是爱还是恨,你都需要单例。实际上每个iOS或Mac OS应用都至少会有UIApplication或NSApplication.什么是单例呢?Wikipedia是如此定义的:在软件工程中,单例是一种用于实现单例的数学概念,即将类的实例化限制成仅一个对象的设计模式。或者我的理解是:单例是一种类,该类只能实例化一个对象。 尽管这是单例的实际定义,但在Foundation框架中不一定是这样。比如NSFileManger和NSNotificationCenter,分别通过它们的类方法defaultManag 阅读全文
posted @ 2013-10-08 17:09 时光独白 阅读(173) 评论(0) 推荐(0)
摘要:原文地址:http://blog.csdn.net/dabiaoyanjun/article/details/81587291、使用方式直接拖放到程序目录下面就可以了:Default.png iPhone默认启动图片, 320x480或者320x460Default@2x.png iPhone4启动图片 640x960或者640x9202、为iPad和iPhone程序增加启动画面非常简单,基本思路就是增加启动图片资源Default.png即可,只是要根据不同的分辨率和旋转方向需要有不同的图片尺寸。目前的iOS设备有三种不同的分辨率:[plain]view plai... 阅读全文
posted @ 2013-10-06 16:58 时光独白 阅读(474) 评论(0) 推荐(0)
摘要:ios屏幕分辨率各不相同,但ios提供了一种考虑分辨率的简单方式。例如,iphone屏幕大小为320*480点这里的“点”不是像素,iphone采用了Retina屏幕,在此之前,iphone的屏幕分辨率是320*480像素,现在ios设备的实际分辨率为上述分辨率与缩放因子的乘积,这意味着虽然对元素进行定位时使用的是数字320*480,但像素可能更多例如 iphone4和iphone5的缩放因子为2,这意味着这些设备的实际分辨率为640*960像素,这看起来很大,但别忘了,所有这些像素都将显示在对角线大约为3.5英寸的屏幕上。扩展阅读:http://www.zhihu.com/question/ 阅读全文
posted @ 2013-10-06 15:26 时光独白 阅读(618) 评论(0) 推荐(0)
摘要:长久以来,Apple一直致力于对用户体验进行控制,确保无论用户如何设置其设备以及设备是Mac,iphone还是ipad,用户体验都很不错,通过将应用程序与开发人员关联起来并实施批准措施,可减少有害的应用程序破坏数据或给用户带来负面影响,然而,这种方法是否适合还有待讨论。 阅读全文
posted @ 2013-10-06 15:09 时光独白 阅读(263) 评论(0) 推荐(0)