1.使用for循环遍历数组 NSArray * array = @[@"one",@"two",@"three"]; for (int i = 0; i < array.count; i++) { NSString * str = ar...
分类:
编程语言 时间:
2014-12-06 16:37:03
阅读次数:
198
1.
NSMutableAttributedString *content = [[NSMutableAttributedString
alloc]initWithString:[NSString
stringWithFormat:@"注册即视为同意xxx注册协议"]];
2.
NSRange contentRange = {0,[conten...
分类:
其他好文 时间:
2014-12-06 15:27:29
阅读次数:
139
1、字符串的末尾追加字符串 NSString * str1 = @"www."; NSString * str2 = [str1 stringByAppendingString:@"baidu.cn"];2、字符串指定范围追加字符 NSString * str3 = @"www.cn...
分类:
其他好文 时间:
2014-12-06 15:22:00
阅读次数:
165
A.内存管理 NSString: copy 基本数据类型、结构体(int, CGFloat, BOOL, CGRect等):assign 对象(如自定义model类型、NSArray、NSDictionary):strong 控件:weak
分类:
移动开发 时间:
2014-12-06 01:25:52
阅读次数:
165
已经很长一段时间没有更新博客了,今天写了个弹出框,主要用于SDK里面
现贴出来分享下:
#import
@interface SYTipView : NSObject
+ (SYTipView *)shareInstance;
- (void)showSuccessTipWithText:(NSString *)tipText;
- (void)showErrorTipWithText:(...
分类:
移动开发 时间:
2014-12-05 19:22:06
阅读次数:
214
description是所有类都有的一个方法。我们重写这个方法,可以自定义实例输出的信息。比如我们创建一个Person类:在.h文件中添加两个属性:#import @interface Person : NSObject@property (strong, nonatomic) NSString *...
分类:
移动开发 时间:
2014-12-05 15:29:33
阅读次数:
645
#pragma mark - 检测非法字符//姓名只能由中文、字母或数字组成- (BOOL)isValidateUser:(NSString *)text{ NSString * regex = @"^[a-zA-Z0-9_\u4e00-\u9fa5]+$"; NSPredicate *pred.....
分类:
其他好文 时间:
2014-12-05 15:27:08
阅读次数:
164
/* NSRange 范围(location length) NSPoint\CGPoint 点 NSSize\CGSize ui元素的宽高 NSRect\CGRect*//* NSString 不可变字符串 ->NSMutableStri...
分类:
其他好文 时间:
2014-12-05 10:44:16
阅读次数:
118
NSBundle一.获取图片1. NSString *path = [[NSBundle mainBundle] pathForResource:@"resourceName" ofType:@“resourceType"]; UIImage *image = [[UIImageimageW...
分类:
其他好文 时间:
2014-12-05 10:32:35
阅读次数:
160
/** * 计算指定时间与当前的时间差 * @param compareDate 某一指定时间 * @return 多少(秒or分or天or月or年)+前 (比如,3天前、10分钟前) */+(NSString *) compareCurrentTime:(NSDate*) compareD...
分类:
移动开发 时间:
2014-12-04 21:33:23
阅读次数:
312