代码改变世界

阅读排行榜

NSString中添加百分号

2012-08-23 09:16 by Y_York, 3308 阅读, 收藏,
摘要: 百分号在objc中是%%,例如:NSString *criteria = [NSString stringWithFormat:@"WHERE username LIKE '%@%%'",name]; 阅读全文

自定义UIActionSheet背景、按钮

2012-10-14 19:43 by Y_York, 3299 阅读, 收藏,
摘要: 1. 自定义ActionSheet背景首先 #import <QuartzCore/QuartzCore.h>然后实现UIActionSheetDelegate方法:- (void)willPresentActionSheet:(UIActionSheet*)actionSheet { UIImage*theImage =[UIImage imageNamed:@"detail_menu_bg.png"]; theImage =[theImage stretchableImageWithLeftCapWidth:32 topCapHeight:32]; CGSi 阅读全文

iOS自带的背景图片

2012-11-04 20:15 by Y_York, 341 阅读, 收藏,
摘要: 原来这张经典的图和分组表的背景一样,都是背景自带的呀。self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; +(UIColor *)scrollViewTexturedBackgroundColorDescriptionReturns the system pattern color used to render the area behind scrollable content.ReturnsThe UIColor object.AvailabilityiOS (3.2 and later)Declared 阅读全文

NSUserDefaults保存问题

2012-12-05 15:24 by Y_York, 282 阅读, 收藏,
摘要: If you terminate your app by pressing the home button (in the Simulator or on the device), your User Defaults will get saved.If you terminate your app by pressing "Stop" in Xcode (in the Simulator or on the device), your User Defaultsmightget saved, but there's a good chance they won&# 阅读全文

AVAudioPlayer 在dealloc中release时exc_bad_access问题

2012-12-26 14:30 by Y_York, 266 阅读, 收藏,
摘要: 搞了将近一个小时,在ios6以下的模拟器中都没有问题,只有在ios6中dealloc ViewController时会出现这个问题。原来的代码是这样的:- (void)dealloc { [super dealloc]; [_player release];}最后发现只要改成这样就行,换一下顺序而已,法克!第一次发现super dealloc的顺序不能随便摆,以后统一放最后一句吧- (void)dealloc { [_player release]; [super dealloc];} 阅读全文