SingleClass.m#import @class SingleClass;static SingleClass *instance = nil;@interface SingleClass : NSObject + (instancetype)shareInstance;@end@implem...
分类:
其他好文 时间:
2015-04-21 12:55:00
阅读次数:
99
装饰模式的英文原文是:Attach additional responsibilitities to an object dynamically keeping the same interface. Decorators provide a flexible alternative to subclassing for extending functionality. 意思是:动态的给一个对象添...
分类:
其他好文 时间:
2015-04-21 09:49:37
阅读次数:
191
1.NSArray转换成JSONString //NSArray+JSONString.h@interface NSArray (JSONString)- (NSString *)jsonStringWithPrettyPrint:(BOOL)prettyPrint;@end@implementat...
分类:
Web程序 时间:
2015-04-21 01:45:20
阅读次数:
119
获取未知类型对象的属性通常有两种方式:一是通过自定义注解的方式,通过获取被注解的属性从而获取属性的值,这种方式也是Spring参数注入的重要实现手段二是通过反射获取属性的名称,通过属性名从而获取属性,这种方式在开发时是比较简便易实现的。一、关于注解1、自定义注解 首先定义一个@interface类型...
分类:
编程语言 时间:
2015-04-21 00:13:54
阅读次数:
337
策略模式对应于解决某一个问题的一个算法族,允许用户从该算法族中任选一个算法解决某一问题,同时可以方便的更换算法或者增加新的算法,并且由客户端决定调用那个算法本质: -- 分离算法,选择实现开发中常见的场景:代码实现:package strategy;public interface Strat...
分类:
其他好文 时间:
2015-04-20 23:59:23
阅读次数:
380
iOS开发中要想存储对象可以使用NSCoding,要想存储的对象必须实验NSCoding协议比如我们要存储一个Student对象,那么Student类必须遵循NSCoding协议,然后实现NSCoding中得两个方法。@interface Student : NSObject 然后再.m文件中实现encodeWithCoder:(存)和initWithCoder:(读)方法,这...
分类:
移动开发 时间:
2015-04-20 22:47:30
阅读次数:
185
public interface Executor {
/**
* @param command the runnable task
* @throws RejectedExecutionException if this task cannot be
* accepted for execution
* @throws NullPoint...
分类:
其他好文 时间:
2015-04-20 22:44:41
阅读次数:
104
#import "ViewController.h"
#import
@interface DataModel : NSObject
@property (nonatomic,copy)NSString *stockName;
@property (nonatomic,assign)float price;
@end
@implementation DataModel
@end
...
分类:
移动开发 时间:
2015-04-20 18:33:54
阅读次数:
148
1、接口注释@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})@Retention(RUNTIME)@Documented@Constraint(validatedBy = {IncrementalValidator.c...
分类:
其他好文 时间:
2015-04-20 16:41:17
阅读次数:
97
系统地图:#import "ViewController.h"#import @interface ViewController (){ MKMapView *_mapView; CLLocationManager *_manager; UIImageView* _imageView;}@end@i...
分类:
其他好文 时间:
2015-04-20 16:30:49
阅读次数:
266