摘要: http://blog.csdn.net/sjx19871225/article/details/8650820http://blog.csdn.net/sjx19871225/article/details/8688091 阅读全文
posted @ 2013-05-03 23:22 小乐" 阅读(182) 评论(0) 推荐(0) 编辑
摘要: #import "ViewController.h" #define NAVIGATION_HEIGHT 44 @interface ViewController (private) - (void)initTableView; - (void)initDataArray; - (void)initNavigationBarButton; - (void)addOneCell:(id)sender; - (void)removeOneCell:(id)sender; @end @implementation ViewController @synthesize myTabl 阅读全文
posted @ 2013-05-03 23:08 小乐" 阅读(336) 评论(0) 推荐(0) 编辑
摘要: UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,0,0)];//后面还会重新设置其size。[label setNumberOfLines:0];NSString *s = @"string......";UIFont *font = [UIFont fontWithName:@"Arial" size:12];CGSize size = CGSizeMake(320,2000);CGSize labelsize = [s sizeWithFont:fontconstraine 阅读全文
posted @ 2013-04-28 17:49 小乐" 阅读(1190) 评论(0) 推荐(0) 编辑
摘要: 今天项目中用[Object performSelectorInBackground:@selector(doSomething:) withObject:nil]开了个子线程,然后在这个线程中进行了一系列操作,结果发生了bool _WebTryThreadLock(bool), 0x1498120: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary th 阅读全文
posted @ 2013-04-25 17:55 小乐" 阅读(430) 评论(0) 推荐(0) 编辑
摘要: request = [ASIHTTPRequest requestWithURL:url];[request setDelegate:self];[request startAsynchronous];这段本身没什么问题,在Navigation Controller驱动下,用户点快了之后,异步请求返回慢了,会出respondsToSelector:]: message sent to deallocated instance这种错误。也就是说delegate一般设置为自身,跳到另外一个view之后,自身会被回收,等到ASIHTTPRequest返回结果,准备调用requestFinished或 阅读全文
posted @ 2013-04-15 18:22 小乐" 阅读(748) 评论(0) 推荐(0) 编辑
摘要: 1、- (void)applicationWillResignActive:(UIApplication *)application说明:当应用程序将要入非活动状态执行,在此期间,应用程序不接收消息或事件,比如来电话了2、- (void)applicationDidBecomeActive:(UIApplication *)application说明:当应用程序入活动状态执行,这个刚好跟上面那个方法相反3、- (void)applicationDidEnterBackground:(UIApplication *)application说明:当程序被推送到后台的时候调用。所以要设置后台继续运行 阅读全文
posted @ 2013-04-11 18:03 小乐" 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 转载集合一种是自己写缓存的处理,一种是采用ASIHTTPRequest中的ASIDownloadCache。根据我目前的技术水平和时间花费,我果断选择了后者,事实证明效果也很不错。下面说一下实现方法: 1、设置全局的Cache 在AppDelegate.h中添加一个全局变量[plain]@interface AppDelegate : UIResponder <UIApplicationDelegate>{ ASIDownloadCache *myCache;}@property (strong, nonatomic) UIWindow *window;@property (non 阅读全文
posted @ 2013-04-11 14:50 小乐" 阅读(517) 评论(0) 推荐(0) 编辑
摘要: 有时候我们需要程序退出后台或者程序在后台返回前台的时候触发一些事件,这时候我们就可以这样写来触发 [[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector()name:UIApplicationDidBecomeActiveNotificationobject:nil];在selector里面添加要触发的事件就可以了,name就是你需要在什么notification触发这个事件 [[NSNotificationCenterdefaultCenter]removeObserver:selfname:UIAppli 阅读全文
posted @ 2013-04-08 17:18 小乐" 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 添加addSubview:insertSubview:atIndex: (放到index层,越往下,index越小)insertSubview:aboveSubview:(把前一个View放在后一个View 的上面)insertSubview:belowSubview:(把前一个View放在后一个View 的下面)整理bringSubviewToFront: (把一个View放到上面)sendSubviewToBack:(把一个View放到下面)exchangeSubviewAtIndex:withSubviewAtIndex:(来修改遮挡。我的理解是view按照控件加进去的顺给了个index 阅读全文
posted @ 2013-04-01 18:15 小乐" 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Object-C 创建对象分为两个步骤 : 分配内存、初始化例:Fraction *frac=[[Fraction alloc] init] ;1.alloc 是从 NSObject 继承而来的类方法,用于给对象分配足够的存储空间,赋于初值为0。(整数类型为 0,浮点数为 0.0,BOOL 为 NO,对象类型为 nil,alloc 方法返回对象的指针)2.init是从NSObject继承而来的成员方法,如果你创建自己的类,那你需要定制自己的 init 方法。Object-C 对 init 方法没有特殊的要求,就是一个普通方法而已,只不过习惯以init 作为方法前缀,这种方法的作用就是为对象初始 阅读全文
posted @ 2013-03-22 14:41 小乐" 阅读(461) 评论(0) 推荐(0) 编辑