摘要: 在函数声明中,使用Block(在c#里,应该叫匿名委托),在处理简单事件时,显得十分的方便,先看一段代码://在.h中定义函数声明-(void)processJsonObject:(id) obj atIndex:(NSInteger)index DictionaryObjectUsingBlock:(void (^)(id key, id value))dictionaryHandler NS_AVAILABLE(10_6, 4_0);//在.m中定义实现-(void)processJsonObject:(id) obj atIndex:(NSInteger)index Dictionary 阅读全文
posted @ 2013-01-24 22:22 静候良机 阅读(1446) 评论(0) 推荐(0) 编辑
摘要: 1、[NSBundle mainBundle],文件夹其实是Group,如左侧的树形文件管理器Build之后,文件直接就复制到了根目录下,于是读取的方法,应该是这样:NSString *earth = [[NSBundle mainBundle] pathForResource:@"Brad Cox" ofType:@"png"];2、使用文件夹的时候,Build结果依然使用同样的方法,不需要制定文件夹路径//inDirectory参数可有可无NSString *earth = [[NSBundle mainBundle] pathForResource 阅读全文
posted @ 2013-01-17 21:49 静候良机 阅读(16984) 评论(0) 推荐(0) 编辑
摘要: NSArray *array = @[@"string 1", @"string 3", @"string 4", @"string 2" ]; //使用block,枚举所有数组元素,相当于forin循环 NSLog(@"排序之前:\n"); [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSLog(@"object at index %d = %@\n", idx, obj 阅读全文
posted @ 2013-01-17 11:42 静候良机 阅读(629) 评论(0) 推荐(0) 编辑
摘要: 1、NSNumber是面向对象的,如果使用非面向对象的类,可以使用NSInteger、NSUInteger、CGFloat、double2、实例化、使用NSNumber *signedNumber = [NSNumber numberWithInteger:-123456];NSNumber *unsignedNumber = [NSNumber numberWithUnsignedInteger:123456];NSNumber *floatNumber = [NSNumber numberWithFloat:123.123456f];NSNumber *doubleNumber = [NS 阅读全文
posted @ 2013-01-17 10:52 静候良机 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 先看下面的代码:-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{ DetailViewController*detailViewController=[[DetailViewControlleralloc]init]; detailViewController.nameLabel.text= @"选中的数据"; [self.navigationControllerpushViewController:detailViewControlleranim 阅读全文
posted @ 2012-10-25 16:51 静候良机 阅读(1261) 评论(1) 推荐(0) 编辑
摘要: 根据nib名称可以实现根据配置文件实例化UIViewController,也可以使用instantiateViewControllerWithIdentifier方法从Storyboard实例化UIViewControllerUIViewController*vc;//判断nib是否存在,如果存在,就加载if([[NSBundlemainBundle]pathForResource:destinationofType:@"nib"]!=nil){vc=[[UIViewControlleralloc]initWithNibName:destinationbundle:nil] 阅读全文
posted @ 2012-05-21 21:22 静候良机 阅读(334) 评论(0) 推荐(0) 编辑
摘要: BitmapImage只能在使用@Embed位图,要想在运行时加载,可以参考下面的代码1<?xmlversion="1.0"encoding="utf-8"?>2<s:Applicationxmlns:fx="http://ns.adobe.com/mxml/2009"3xmlns:s="library://ns.adobe.com/flex/spark"4xmlns:mx="library://ns.adobe.com/flex/mx"minWidth="955&q 阅读全文
posted @ 2012-04-10 15:22 静候良机 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 给自定义组件编写事件,可以分为3部分:1、自定义事件,events.LightEvent.as 1packageevents2{3importflash.events.Event;45publicclassLightEventextendsEvent6{7publicstaticconstLightClick:String="LightClick";89publicfunctionLightEvent(type:String,bubbles:Boolean=false,cancelable:Boolean=false)10{11super(type,bubbles,canc 阅读全文
posted @ 2012-04-08 21:49 静候良机 阅读(1502) 评论(1) 推荐(0) 编辑
摘要: Implementing the IToolTip interfaceYou can also create a custom ToolTip by extending an existing control, such as a Panel or other container, and implementing the IToolTip interface. The following example uses a Panel container as the base for a new implementation of the IToolTip interface: 1<?xm 阅读全文
posted @ 2011-07-08 14:32 静候良机 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 如果不需要打印全部,请删除不需要打印的拼音,然后按右侧的设置进行操作:识字 1.(√)wàn,bǎi wàn,wàn yī,wàn lǐ wú yúndīng,dīng dōng,rén dīngdōng,dōng tiān,dōng guā,dōng rìqí,qí xīn第1课.(√)shuō,shuō huà,shuō shū,xiǎo shuōhuà,diàn huà,huí huàpéng,péng yǒu 阅读全文
posted @ 2011-06-07 14:57 静候良机 阅读(495) 评论(0) 推荐(0) 编辑