IOS 消息推送

推送参考 IOS开发之实现App消息推送 主要流程 1.你的IOS应用需要去注册APNS消息推送功能。 2.当苹果APNS推送服收到来自你应用的注册消息就会返回一串device token给你(很重要) 3.将应用收到的device Token传给你本地的Push服务器。 4.当你需要为应用推送……

阅读全文

app 与 服务器 交互

step1封装post数据 //请求地址 NSString *url = [NSString stringWithFormat:@"%@%@", [PKConfig apiUrl], service]; PKLog(@"请求地址是 %@",url); //时间戳 long long timestamp = [[NSDate date] timeIntervalSince1970]; NSString *timestampStr = [NSString stringWithFormat:@"%lld", timestamp]; //参数 NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init]; NSData *postData = nil; if(type!=1){ // Service [parameters setObject:service forKey:@"service"]; // ID [parameters setObject:timestampStr forKey:@"id"]; // Common NSMutableDictionary *commonDict = [[NSMutableDictionary alloc] init]; [commonDict setObject:@([PKConfig vc]) forKey:@"vc"]; [commonDict setObject:[PKConfig vn] forKey:@"vn"]; [commonDict setObject:@"1" forKey:@"build"]; [commonDict setObject:[PKConfig uuid] forKey:@"uuid"]; [commonDict setObject:[PKConfig imei] forKey:@"imei"]; [commonDict setValue:[PKConfig os] forKey:@"os"]; [commonDict setObject:[PKConfig ch] forKey:@"ch"]; [commonDict setObject:[PKConfig osSdk] forKey:@"osSdk"]; [commonDict setObject:[PKConfig caller] forKey:@"caller"]; [parameters setObject:commonDict forKey:@"common"]; // Param [parameters setObject:paramDict forKey:@"param"]; //……

阅读全文

UitextView的动态调整

根据字体和设定宽度计算高度 //自适应字体 - (CGSize)sizeWithString:(NSString*)string font:(UIFont*)font width:(float)width { CGRect rect = [string boundingRectWithSize:CGSizeMake(width,80000) options:NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesFontLeading|NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil]; return rect.size; } 限制高度截取内容 //获取字体高度 - (CGFloat)getTextHeight:(NSString*)string{ CGSize size = CGSizeMake(PKScreenW - 32 - 10, MAXFLOAT); CGFloat height; if (string == nil) { height = [@"高" boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size.height; } else { height = [string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size.height; } return height; } //获取指定高度所含字符内容 - (NSString*)getTextWithHeight:(CGFloat)heigth andString:(NSString*) str{ //NSString *str = self.textView.text; NSInteger i = 0 ;……

阅读全文

GIT 分支 开发模式 理解

master 主分支为必要分支!稳定版本! dev(例:v1.0.3) dev为子分支!每次制需求一个开发分支! commit,pull,push正常开发 对应自己的dev版本 需求稳定,合并到主分支 删除dev分支 fixBug(djcars项目特有) commit pull push 对应 (master) dev_version dev_version 为需求细分下个人分支!实际操作! commit 只……

阅读全文

layoutIfNeeded setNeedsLayout layoutSubviews 区别

layoutSubviews 可按需要重写内部函数 init初始化不会触发layoutSubviews addSubview会触发layoutSubviews 设置view的Frame并发生变化会触发layoutSubviews 滚动一个UIScrollView会触发layoutSubviews 旋转Screen会触……

阅读全文

Masonry 约束框架使用

Masonry第三方约束 (2016.4.14更新) cocospads add file Masonry_github 只使用Masonry文件夹内容 使用cocospad 安装 product -> cocoaPods ->install pods (注意路径) gem_path: /usr/local/bin install 后一等一会 会有输出提示 代码设置 // 只要添加了这个宏,就不用带mas_前缀 #define MAS_SHORTHAND // 只要添加了这个宏,equalTo就等价于mas_equalTo #define……

阅读全文

UIButton,UILabel 控件样式

UIButton btn文字下划线样式 NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"查看所有中奖记录"]; NSRange strRange = {0,[str length]}; [str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange]; [self.btn setAttributedTitle:str forState:UIControlStateNormal]; btn边框样式 - (UIButton*)btn{ if (_btn == nil) { UIButton * btn = [[UIButton alloc]init]; // 外边框 btn.layer.masksToBounds = YES; btn.layer.cornerRadius = 2; btn.layer.borderWidth = 1; //btn.layer.borderColor = PKBtnSelectedColor.CGColor; btn.layer.borderColor = [UIColor blueColor].CGColor; // 文字 btn.titleLabel.textAlignment = NSTextAlignmentCenter; //字体大小 btn.titleLabel.font = [UIFont systemFontOfSize: 12.0]; //文字内容 [btn setTitle:@"" forState:UIControlStateNormal]; //消息回调 [btn addTarget:self action:@selector(btnClick)……

阅读全文

网页 交互 框架 js

网页交互框架/() 1初始化 注册moduleAPIs dict 1代码 FDWebViewController初始化时,要顺便把WAUserInterfaceAPI ,WebAppBridge 初始化 代码 - (void)viewDidLoad { self.webView = [[WAWebView alloc] init]; self.webView.moduleAPIs = @[[WADeviceAPI sharedInstance], [[WAUserInterfaceAPI alloc] initWithContext:self], [WAUserAPI sharedInstance]]; } 字典key //self.webView.moduleAPIs _ type is NSMutableArray,val is: [0] (null) @"user" : (no summary) [1] (null) @"device" : (no summary) [2] (null) @"UI" : (no summary) (看情况手工处理) 2其中……

阅读全文