- 博客(27)
- 收藏
- 关注
原创 百度地图API,授权失败,错误码:240
最近要集成百度地图,让公司领导注册一个百度账号,拿AK,结果填上之后,-(void)onCheckPermissionState:(BMKLocationAuthErrorCode)iError{ if (0 == iError) { NSLog(@"鉴权成功"); } else { NSLog(@"鉴权失败:%ld", (long)iError); }}- (void)onGetPermissionState:(int)iE...
2020-09-10 13:24:53
2487
原创 设置textfiel的Placeholder
textfield.attributedPlaceholder=[[NSAttributedString alloc]initWithString:@"请输入"attributes:@{NSForegroundColorAttributeName:kTextColor999999}];
2020-09-08 02:04:29
167
原创 AVCaptureMovieFileOutput 录制视频超过10s没有声音
解决方案self.FileOutput=[[AVCaptureMovieFileOutput alloc]init];self.FileOutput.movieFragmentInterval = kCMTimeInvalid;
2020-08-27 09:27:34
748
原创 nslog 打印控制台显示中文
#ifdef DEBUG#define NSLog(FORMAT, ...) fprintf(stderr,"\n %s:%d %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],__LINE__, [[[NSString alloc] initWithData:[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] dataUsingEncodi.
2020-08-17 11:36:34
316
原创 swift Alamofire get 请求出现 Error Domain=NSURLErrorDomain Code=-1001 "请求超时。" UserInfo={NSUnderlyingErro
Error Domain=NSURLErrorDomain Code=-1001 "请求超时。" UserInfo={NSUnderlyingError=0x1c0a48310 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErr...
2019-11-18 18:18:44
6356
转载 iOS开发——多线程、NSThread、gcd、线程间通信
1.基本概念1.1 进程进程是指在系统中正在运行的一个应用程序。每个进程之间是独立的,每个进程均运行在其专用且受保护的内存空间内。1.2 线程(1)基本概念1个进程要想执行任务,必须得有线程(每1个进程至少要有1条线程),线程是进程的基本执行单元,一个进程(程序)的所有任务都在线程中执行。(2)线程的串行1个线程中任务的执行是串行的,如果要在1个线程中执行多个任务,那么...
2019-09-23 16:03:34
268
转载 多线程中 wait和sleep的区别
1.wait 可以指定时间也可以不指定指定时间 wait(time)在 time时间内 有别的线程 notifyAll() 是不会唤醒到它sleep 必须指定时间2.在同步中,对cpu的执行权和锁的处理不同wait:释放执行权,释放锁 (指定时间 那段时间不去抢线程)sleep:释放执行权,不释放锁(相当于等待一定时间然后继续向下执行)————...
2019-09-23 15:45:30
112
转载 iOS 判断多个子线程都执行完成
- (void)requestDataList{ dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_group_t group = dispatch_group_create(); dispatch_group_asyn...
2019-09-23 15:39:17
311
转载 为什么dispatch_get_current_queue被废弃
GCD队列是按照层级结构来组织的,无法单用某个队列对象来描述“当前队列” dispatch_get_current_queue函数可能返回与预期不一致的结果 误用dispatch_get_current_queue可能导致死锁 设置队列specific可以把任意数据以键值对的形式关联到队列里,从而得到需要的指定队列...
2019-09-23 15:35:13
469
原创 iOS中使用UI控件时,修饰符用strong?还是weak好呢?(复制过来的,技术积累)
在现在开发中,一般都是在ARC中,对于ARC来说,对象释放的最终根据还是根据引用计数为0时去释放。而weak与strong的根本区别是在set方法中,weak的set方法和strong的set方法都是释放旧值保留新值,但是weak的set方法会对其autorelease,即延迟release一次,而strong的set方法也是释放旧值保留新值,但是其不会延迟release。最终效果是strong会...
2019-09-23 15:21:14
294
原创 UIView的动画中block回调里self要不要弱引用?
UIView的动画block不会造成循环引用的原因就是,这是个类方法,当前控制器不可能强引用一个类,所以循环无法形成。不需要,之所以需要弱引用本身,是因为怕对象之间产生循环引用,引起程序的崩溃!所谓“引用循环”是指双向的强引用,所以那些“单向的强引用”(block 强引用 self )没有问题...
2019-09-23 15:17:40
1110
原创 iOS 处理时间带‘‘T’’的时间格式
-(NSString *)changeStringToDate:(NSString *)string { //带有T的时间格式,是前端没有处理包含时区的,强转后少了8个小时,date是又少了8个小时,所有要加16个小时。 NSString *str =[string stringByReplacingOccurrencesOfString:@"T"wit...
2019-06-05 17:27:26
4119
原创 iOS 位置动画
[UIView animateWithDuration:0.3 animations:^{ self->_shareView.transform = CGAffineTransformMakeTranslation(0, -168); } completion:^(BOOL finished) { }]; [UIView animateWithD...
2018-11-23 15:39:32
291
原创 把vc的view加在另一个ViewController上需要注意的问题
在把vc的view加上之前,一定要把vc存到数组里,要不然,加上之后vc就会被释放,然后发生各种神奇的BUG [_vcArr addObject:oneV]; [_vcArr addObject:twoV]; [_vcArr addObject:threeV]; [rootScrollView addSubview:oneV.view]; [root...
2018-11-16 09:55:46
1105
原创 设置字符串中数字的颜色
- (NSMutableAttributedString *)modifyDigitalStr:(NSString*)str color:(UIColor *)color normalColor:(UIColor *)normalColor;{ NSRegularExpression *regular = [NSRegularExpression regularExpressionW...
2018-11-15 15:36:03
356
原创 iOS 微信支付,APPID未关联PaySignKey
最近集成微信支付,iOS正常导入库,调起微信的时候出现这么个情况 原因呢可能是因为后台没仔细看文档 prepayid这个字段是订单号,需要后台调微信接口来获取,正常应该长这个样子prepayid=wx03162103469366a9464a766c3712574076所以,这是后台的锅...
2018-08-03 16:53:11
2759
原创 NSData
//NSString与NSData之间的转换 NSString *str = @"abcdefg"; NSData *strData = [str dataUsingEncoding:NSUTF8StringEncoding];//把字符串变成data NSLog(@"%@",strData); NSString *backStr = [[NSStri...
2018-03-27 23:03:37
472
原创 获取当前indexPath Cell
//创建第0区第1行的indexPathNSUInteger newIndex[] = {0, 1};NSIndexPath *newPath = [[NSIndexPath alloc] initWithIndexes:newIndex length:2];//找到对应的cellUITableViewCell *nextCell = [self.tableView cellForRowAtInd...
2018-03-22 11:05:44
1066
原创 NSString转NSNumber
NSString *str = @"120". NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; NSNumber *numTemp = [numberFormatt...
2018-03-21 14:50:10
690
原创 Json字符串转字典,数组
//1、写一个Json字符串 NSString *arrJsonStr = @"[\"pp\",\"qq\"]";//这个\后面的第一个字符只是一个字符,没有任何意义 NSLog(@"%@",arrJsonStr); //Json字符串是这样的格式:@"",""中间任何内容不要加上@符号,字符串用""括起来,而不是@""括起
2018-03-17 17:59:33
1056
原创 Undefined symbols for architecture i386: "_OBJC_CLASS_$_AFHTTPRequestSerializer", referenced from:
2018-03-16 20:53:58
1650
原创 [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/con
[MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles崩到Main,是因为手机没有在开发者证书上添加...
2018-03-15 00:09:11
2225
原创 选择日期计算出星期几
-(NSString *)getTheDayOfTheWeekByDateString:(NSString *)dateString{ NSDateFormatter *inputFormatter=[[NSDateFormatter alloc]init]; [inputFormatter setDateFormat:@"yyyy-MM-dd"]; NS...
2018-03-13 16:57:08
206
原创 iOS UIAlertController 文字左对齐
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *action1 = [UIAlertAction actionWithTitle...
2018-02-26 17:54:31
2532
1
原创 IOS复制链接功能
UIPasteboard *pasted=[UIPasteboardgeneralPasteboard];pasted.string=self.shareUrl;
2017-11-10 17:00:31
2094
转载 IOS 为UILabel和UIImageView添加长按复制功能
IOS 为UILabel和UIImageView添加长按复制功能本文为ctrl+c文章转至http://blog.youkuaiyun.com/lrenjun/article/details/12582927在iOS中下面三个控件,自身就有复制-粘贴的功能: 1、UITextView 2、UITextField 3、UIWebView
2015-11-14 18:09:26
260
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人