iOS
GW-wen
这个作者很懒,什么都没留下…
展开
-
labels适应文字高度
CGRect rect = [str boundingRectWithSize:CGSizeMake(WIDTH, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17]} context:nil]; return rect.si原创 2016-12-20 09:31:51 · 351 阅读 · 0 评论 -
webView下登录问题
1.获取html下的cookie NSArray *nCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]; NSHTTPCookie *cookie; for (id c in nCookies) { if ([c isKindOfClass:[NSHTTPCookie class原创 2017-03-17 14:07:41 · 241 阅读 · 0 评论 -
FMDB的使用
#import <Foundation/Foundation.h>#import "FMDatabase.h"@interface WWFMDB : NSObject/** 创建表 @param db fmdb @param tableName 表名 @param keys 所有的键 @return 成功返回YES,失败NO */+(BOOL)createDB:(FMDatabas原创 2017-03-14 16:28:35 · 201 阅读 · 0 评论 -
生成二维码,长按识别二维码
1.生成二维码/** 生成二维码 */-(void)createCode{ //二维码滤镜 CIFilter *filter=[CIFilter filterWithName:@"CIQRCodeGenerator"]; //恢复滤镜的默认属性 [filter setDefaults]; //将字符串转换成NSData NSString * se原创 2017-03-14 13:38:02 · 1183 阅读 · 0 评论 -
排序
1.选择-(void)sequence1{ NSMutableArray * array = [[NSMutableArray alloc] initWithArray:@[@1,@3,@2,@9,@7,@6]]; for (int i = 0; i<array.count-1; i++) { for (int j = i; j<array.count; j++) {原创 2017-03-11 10:22:11 · 160 阅读 · 0 评论 -
倒计时实现的两种方法
创建button-(void)createBtn{ self.btn = [UIButton buttonWithType:UIButtonTypeCustom];//UIButtonTypeSystem时会闪 self.btn.frame = CGRectMake(100, 100, 140, 100); self.btn.backgroundColor = [UIColo原创 2017-03-10 17:49:41 · 409 阅读 · 0 评论 -
app进入QQ好友或者QQ群
QQ好友-(void)qqWithQQNumber:(NSString *)qqNumber{ UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"mqq://im/chat?原创 2017-03-17 14:56:51 · 1327 阅读 · 0 评论 -
CAGradientLayer的使用(渐变)
1.颜色渐变-(void)createUI{ UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(10, 400, 350, 20)]; [self.view addSubview:myView]; // 创建 CAGradientLayer 对象 CAGradientLayer *gradientLa原创 2017-02-09 11:51:21 · 415 阅读 · 0 评论 -
label 适应文字长度
(void)setupLabel { UILabel *textLabel = [[UILabel alloc] init]; textLabel.font = [UIFont systemFontOfSize:16]; NSString *str = @”label上的title”; textLabel.text = str; textLabel.backgroundColor = [U原创 2016-12-06 13:30:16 · 904 阅读 · 0 评论 -
昨天今天明天
今天昨天明天时间戳NSDate * date = [NSDate date];//当前时间NSDate *lastDay = [NSDate dateWithTimeInterval:-24*60*60 sinceDate:date];//前一天NSDate *nextDay = [NSDate dateWithTimeInterval:24*60*60 sinceDate:date];//后一原创 2016-12-14 14:08:16 · 762 阅读 · 0 评论 -
时间、时间戳互相转换问题
时间戳转时间+(NSString *)timeStampChangedTimeWithTimeStr:(NSString *)timeStr{ long long int date1 = (long long int)[timeStr intValue] + 8*60*60; NSDate * date2 = [NSDate dateWithTimeIntervalSince1970原创 2016-12-27 13:41:00 · 776 阅读 · 0 评论 -
GCD的使用
1.The main queue(主线程串行队列): 与主线程功能相同,提交至Main queue的任务会在主线程中执行-(void)mainQueue{ dispatch_queue_t mainqueue = dispatch_get_main_queue(); dispatch_async(mainqueue, ^{ NSLog(@"主线程串行队列异步任务,在主原创 2017-04-05 14:59:46 · 261 阅读 · 0 评论