1.Code:@interface SAMNetworkingTool : NSObject+ (instancetype)shareNetworkingTool;@end@implementation SAMNetworkingToolstatic id instance;// 因为历史遗留问题,...
分类:
其他好文 时间:
2015-07-05 21:02:54
阅读次数:
105
先定义一个Student类: 1 @interface Student : NSObject{ 2 int _age; 3 } 4 -(void)setAge:(int)newAge; 5 -(int)age; 6 @end 7 8 //实现 9 @implementation Stude...
分类:
其他好文 时间:
2015-07-03 00:04:02
阅读次数:
131
2014-07-07更新:苹果在iOS 8中全面使用instancetype代替idSteven Fisher:只要一个类返回自身的实例,用instancetype就有好处。@interface Foo:NSObject - (id)initWithBar:(NSInteger)bar; // in...
分类:
移动开发 时间:
2015-07-02 22:25:41
阅读次数:
211
RT// 增加成员变量
#import @interface NSObject (AddProperty)
@property (nonatomic,strong) NSString *stringProperty;
@property (nonatomic,assign) NSInteger integerProperty;
@end
#impor...
分类:
移动开发 时间:
2015-07-02 17:35:44
阅读次数:
131
iOS中键盘的使用很频繁,有时给键盘上添加一个控制栏可以方便快捷的在不同输入框内进行切换或隐藏
这里简单说下具体实现方式
初始化一个UIToolBar并添加到界面,随着键盘的高度的更改而动态更改,从而进行展示
下面来看代码实现
头文件部分
#import
#import
@interface UIKeyboardTool : NSObject
///用于界面展示的toolbar
@...
分类:
移动开发 时间:
2015-07-02 15:51:42
阅读次数:
178
前一篇文章用c#处理了证书,这次就使用oc来试一下,其实基本原理累似,一般都是自己覆盖几个函数,然后自己处理证书相关的东西。
自己创建一个类,如:
@interface MyURLConnection : NSObject
- (void) sendPostRequest: (NSURL*)url postData: (NSData*)postData;
@end
我比较喜欢把一些不需...
分类:
Web程序 时间:
2015-07-02 15:48:36
阅读次数:
146
id类型数据类型: 1.可以用来定义变量 2.可以用来当作参数 3.可以用来当作返回值 id类型是一个万能指针(可以保持任何对象的地址)id相当于NSObject *id的本质typedef struct objc_object *id;id是一个动态类型,在运行时才确定id的真实类型id类...
分类:
其他好文 时间:
2015-07-01 20:05:58
阅读次数:
109
#import
#import
#import "Reachability.h"
@interface HttpHelper : NSObject
+ (BOOL)NetWorkIsOK;//检查网络是否可用
+ (void)post:(NSString *)Url RequestParams:(NSDictionary *)params FinishBlock:(void (^)(NSU...
分类:
移动开发 时间:
2015-07-01 18:19:12
阅读次数:
156
直接上代码 代码里面有注释 1 #import 2 3 @interface Animal : NSObject 4 //类方法使用 “+”开头 不带参数的 5 +(void)eat; 6 7 +(void)eat02:(NSString *)name; 8 9 @end10 11 12 @...
分类:
其他好文 时间:
2015-07-01 17:46:45
阅读次数:
115
首先要新建一个MyMD5的类,继承NSObject,把下面这个类方法封装起来,方便以后其他类需要调用。+(NSString *)md5:(NSString*)str{ NSLog(@"MD5加密的方法"); const char *cStr = [str UTF8String]; unsigned ...
分类:
移动开发 时间:
2015-07-01 13:57:53
阅读次数:
173