请教大神,关于sdwebimage清除缓存3.7.5在ios9.2的适配问题

感觉还没好好享受春天,夏天就近在眼前了,小编还有点懵逼,所以说不出多少废话了,祝...
iPhone SE 上市已经超过一个星期了,一个星期的体验下来,我们有些东西想和大家分享,...
本作画面风格独特,很有《破碎大陆》的感觉,适合时间比较琐碎的玩家。
在现役 Apple Watch 用户看来,他们更希望苹果从其他方面强化 Apple Watch。
最重要的是 iPhone 6s Plus 经历可乐浸泡和冷冻 9 小时后,依然可以开机正常运行,这...
看看我们中国市场,光是初期预订就突破 350 万台了。
G5在模块化的概念下得到了重生,通过一系列扩展配件,它在续航时间、拍照体验和音质表...
好准的枪法,好可怕的老妈,“我要夺回作为你们母亲的尊严!”
刀塔的故事背景我想不少朋友已经很熟悉,再重复灌输难免显得有些啰嗦,详细的剧情小...
游戏乍看上和普通的网球游戏比较类似,玩家与对手将会分别站在场地的两侧,而在场地的...
游戏采用了像素风格的画面设计,这也让这款游戏的复古感觉更加重,游戏的场景将以横版...
SE 旗下《王国之心》系列手游《王国之心:解放之匙(KINGDOM HEARTS Unchained χ)》...
《Musixmatch(音乐与歌词)》是一款“万金油”式的音乐播放器,早在三年前上架,已经...
现在这是一个看脸的时代,一个好的长相可以更容易获得成功,除了在现实生活中的人是如...
跑酷类游戏在移动平台中应该说已经是烂大街的游戏作品了,几乎我们能够想到的题材都有...
TimePorter的外形有点像我们平时用的眼镜盒,只不过它里边放置的是Apple Watch的配件...
Moleskine 品牌所象征的,是一个源远流长的笔记本、日志和城市指南的世家。
尽管手游越来越流行,但在某些核心向动作/赛车类游戏中,触屏所能提供的操作体验远远...
如果你也有兼顾各种喜好和风格而更换表带的习惯,那么全新的表带一定可以让你的个人风...
iPhone SE 推出之后,相应的周边估计又要火起来了,现在,让我们把目光聚焦在苹果官方...
如今 9.7 英寸的 iPad Pro 已经推出,对于不少果粉来说颇具诱惑力,说到这里,我想一...
3月23日极米科技在北京发布了全新的极米无屏电视H1。而威锋网也第一时间拿到了极米无...
苹果官方配件价格可能稍贵,但在品质方面也比较有保证,是这样吗?
关于ios8.1盘古越狱卡在第二步,请教各位大神!
注册时间 最后登录
在线时间136 小时 UID
主题帖子人气
红苹果, 积分 474, 距离下一级还需 26 积分
两天前美化主题的时候,手抖了一下,吧系统自带的图标误删了,结果一直无法使用,不得已升级到8.1系统,可能是人品太差的缘故,今天在用盘古越狱的时候,一直卡在第二步(准备越狱环境),一共就4.5M的东西,却怎么也下载不下来!网络确认没有任何问题,在等待期间我还上网看了宙斯之子,一部电影结束后,它依然坚持在第二步,没有任何进展!
请教各位已经越狱的筒子们!你们是如何安全快速的度过第二步的!谢谢!
注册时间 最后登录
在线时间99 小时 UID
主题帖子人气
使用iTunes重新刷机一遍,不要使用i4和盘古刷机,使用盘古越狱时,win7以管理员身份运行,关闭手机的iCloud和查找iPhone,在越狱,越狱一次失败再来几次就成功了,越狱保证电脑带宽网络一定要通畅,否则一定机率上传和下载越狱配置文件失败的可能性加大。回楼主杜明翰于3 分钟前发表的: 两天前美化主题的时候,手抖了一下,吧系统自带的图标误删了,结果一直无法使用,不得已升级到8.1系统,可能是人品太差的缘故,今天在用盘古越狱的时候,一直卡在第二步(准备越狱环境),一共就4.5M的东西,却怎么也下载不下来!网络确认没有任何问题,在等待期间我还上网看了宙......
<p id="rate_51556" onmouseover="showTip(this)" tip="助人为乐^_^&人气 + 1
" class="mtn mbn">
助人为乐^_^
注册时间 最后登录
在线时间136 小时 UID
主题帖子人气
多谢楼上的同学帮忙!
注册时间 最后登录
在线时间577 小时 UID
主题帖子人气
盘古刷机是可以的&&没有用什么刷机软件区分的&&我刚开始也是一样 后来用盘古刷机也可以
威锋旗下产品
Hi~我是威威!
沪公网安备 29号 丨 沪ICP备号-1 丨 深公安网监备案号 5
增值电信业务经营许可证:
Powered by Discuz!请教大神,关于SDWebImage3.7.5在ios9.2的适配问题_百度知道
请教大神,关于SDWebImage3.7.5在ios9.2的适配问题
提问者采纳
add this in SDWebImageDecoder.m file:
if (!context) {
if (unsupportedColorSpace){
CGColorSpaceRelease(colorspaceRef);
}after this call:CGContextRef context = CGBitmapContextCreate(NULL, width,
CGImageGetBitsPerComponent(imageRef),
colorspaceRef,
kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
Android|HTML5|iOS培训名师面授
主营:Android培训、HTML5培训、iOS培训
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁感觉还没好好享受春天,夏天就近在眼前了,小编还有点懵逼,所以说不出多少废话了,祝...
iPhone SE 上市已经超过一个星期了,一个星期的体验下来,我们有些东西想和大家分享,...
本作画面风格独特,很有《破碎大陆》的感觉,适合时间比较琐碎的玩家。
在现役 Apple Watch 用户看来,他们更希望苹果从其他方面强化 Apple Watch。
最重要的是 iPhone 6s Plus 经历可乐浸泡和冷冻 9 小时后,依然可以开机正常运行,这...
看看我们中国市场,光是初期预订就突破 350 万台了。
G5在模块化的概念下得到了重生,通过一系列扩展配件,它在续航时间、拍照体验和音质表...
好准的枪法,好可怕的老妈,“我要夺回作为你们母亲的尊严!”
刀塔的故事背景我想不少朋友已经很熟悉,再重复灌输难免显得有些啰嗦,详细的剧情小...
游戏乍看上和普通的网球游戏比较类似,玩家与对手将会分别站在场地的两侧,而在场地的...
游戏采用了像素风格的画面设计,这也让这款游戏的复古感觉更加重,游戏的场景将以横版...
SE 旗下《王国之心》系列手游《王国之心:解放之匙(KINGDOM HEARTS Unchained χ)》...
《Musixmatch(音乐与歌词)》是一款“万金油”式的音乐播放器,早在三年前上架,已经...
现在这是一个看脸的时代,一个好的长相可以更容易获得成功,除了在现实生活中的人是如...
跑酷类游戏在移动平台中应该说已经是烂大街的游戏作品了,几乎我们能够想到的题材都有...
TimePorter的外形有点像我们平时用的眼镜盒,只不过它里边放置的是Apple Watch的配件...
Moleskine 品牌所象征的,是一个源远流长的笔记本、日志和城市指南的世家。
尽管手游越来越流行,但在某些核心向动作/赛车类游戏中,触屏所能提供的操作体验远远...
如果你也有兼顾各种喜好和风格而更换表带的习惯,那么全新的表带一定可以让你的个人风...
iPhone SE 推出之后,相应的周边估计又要火起来了,现在,让我们把目光聚焦在苹果官方...
如今 9.7 英寸的 iPad Pro 已经推出,对于不少果粉来说颇具诱惑力,说到这里,我想一...
3月23日极米科技在北京发布了全新的极米无屏电视H1。而威锋网也第一时间拿到了极米无...
苹果官方配件价格可能稍贵,但在品质方面也比较有保证,是这样吗?
跪求关于GPP卡贴7.0升级IOS9无服务求助大神帮忙
注册时间 最后登录
在线时间221 小时 UID
主题帖子人气
青苹果, 积分 150, 距离下一级还需 50 积分
前几天我看到一个关于这个问题解决办法的帖子,那位大神说在引导卡贴选项选第一个,输入一个代码就来信号了,可是那位大神的帖子删了,我私密他他也不回,我自己的有锁机我搞定了,就是参照那位大神的帖子来的信号,非常简单。我现在帮他人有锁机电信刷机到9。0不出信号了,怎么弄都不行,我忘了那个代码是多少了,求有用过那教程的大神或者有解决办法的大神帮忙,告诉我那个代码是多少,那个代码不是原机运营商的代码我试过了,或者其他解决办法,跪求,谢谢了
注册时间 最后登录
在线时间933 小时 UID
主题帖子人气
代码无用回楼主xl 分钟前发表的: 前几天我看到一个关于这个问题解决办法的帖子,那位大神说在引导卡贴选项选第一个,输入一个代码就来信号了,可是那位大神的帖子删了,我私密他他也不回,我自己的有锁机我搞定了,就是参照那位大神的帖子来的信号,非常简单。我现在帮他人有锁机电信刷机到9。0不出信号......
注册时间 最后登录
在线时间221 小时 UID
主题帖子人气
有用,我自己的卡贴机子就是用代码弄好的,很方便回1楼qliuan于4 小时前发表的: 代码无用......
注册时间 最后登录
在线时间221 小时 UID
主题帖子人气
有人知道吗?帮帮忙啊
注册时间 最后登录
在线时间2 小时 UID
主题帖子人气
我的日版有锁AU,GPP7.0,现在用的是电信4G
注册时间 最后登录
在线时间74 小时 UID
主题帖子人气
我有方法弄出4g但是不能关蜂窝数据!一关蜂窝数据就接不了电话了回楼主xl 小时前发表的: 前几天我看到一个关于这个问题解决办法的帖子,那位大神说在引导卡贴选项选第一个,输入一个代码就来信号了,可是那位大神的帖子删了,我私密他他也不回,我自己的有锁机我搞定了,就是参照那位大神的帖子来的信号,非常简单。我现在帮他人有锁机电信刷机到9。0不出信号了......
注册时间 最后登录
在线时间5 小时 UID
主题帖子人气
那个代码就是sim卡应用程序里面的,电信卡就选电信的
注册时间 最后登录
在线时间96 小时 UID
主题帖子人气
用4g不会出问题吗,我解开4g以后锁屏会断网,坐电梯掉信号后,不会自动切换到4g回4楼chenmingapp于3 小时前发表的: 我的日版有锁AU,GPP7.0,现在用的是电信4G......
注册时间 最后登录
在线时间73 小时 UID
主题帖子人气
注册时间 最后登录
在线时间221 小时 UID
主题帖子人气
这是哪个国家的代码?你确定是这个吗?回8楼wj19于1 小时前发表的: 4601100......
威锋旗下产品
Hi~我是威威!
沪公网安备 29号 丨 沪ICP备号-1 丨 深公安网监备案号 5
增值电信业务经营许可证:
Powered by Discuz!今天看啥 热点:
iOS开发中遇到的一些问题及解决方案【转载】,ios一些问题iOS开发中遇到的一些问题及解决方案【转载】
【385】【scrollView不接受点击事件,是因为事件传递失败】
//& MyScrollView.m
//& Created by beyond on 15/6/6.
//& Copyright (c) 2015年
All rights reserved.
//& 不一定要用继承,可以使用分类
#import "MyScrollView.h"
#import "CoView.h"
@implementation MyScrollView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
& & if(!self.dragging)
& & & & UITouch *touch = [touches anyObject];
& & & & CGPoint loc = [touch locationInView:self];
& & & & // x y转成coView中的坐标
& & & & CGFloat x = loc.x - 10;
& & & & CoView *coView = (CoView *)[self viewWithTag:5267];
& & & & CGFloat y = loc.y - coView.y;
& & & & CGPoint newLoc = [coView convertPoint:loc fromView:self];
& & & & // 经过验证:x == newLoc.x & y == newLoc.y
& & & & x = newLoc.x;
& & & & y = newLoc.y;
& & & & // 现在就是通过point
算出 row,col,进而的推算出i
& & & & int col = x/(kBtnWH+kBtnMarginH);
& & & & int row = y/(kBtnWH+kBtnMarginV);
& & & & int i = row*kBtnColumnNum +
& & & & [[self nextResponder] touchesBegan:touches withEvent:event];
& & & & // 注意,coView处理的时候,i越界的情况要处理;i从0开始
& & & & DLog(@"--点了第%d个---",i);
& & & & [coView btnTouched:i];
& & [super touchesBegan:touches withEvent:event];
& & //NSLog(@"MyScrollView touch Began");
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
& & if(!self.dragging)
& & & & [[self nextResponder] touchesEnded:touches withEvent:event];
& & [super touchesEnded:touches withEvent:event];
【382】【带暂停和继续的NSTimer】
@interface NSTimer (Pause)
@property (nonatomic,
strong, readwrite) NSString *
///////////////////////////////////////////////////////////////////////////
#import "NSTimer+Pause.h"
static void *state = (void *)@"state";
@implementation NSTimer (Pause)
-(void)pause
& & if (![self
isValid]) {
& & & & return ;
setFireDate:[NSDate
distantFuture]]; //如果给我一个期限,我希望是 00:00:00 +0000
-(void)resume
& & if (![self
isValid]) {
& & & & return ;
setFireDate:[NSDate
- (NSString *)state
& & return objc_getAssociatedObject(self, state);
- (void)setState:(NSString *)s
& & objc_setAssociatedObject(self, state, s, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
【381】【给分类添加属性】
// Declaration
@interface MyObject (ExtendedProperties)
@property (nonatomic,
strong, readwrite)
id myCustomP
@end Implementation
static void * MyObjectMyCustomPorpertyKey = (void *)@"MyObjectMyCustomPorpertyKey";
@implementation MyObject (ExtendedProperties)
- (id)myCustomProperty
& & return objc_getAssociatedObject(self, MyObjectMyCustomPorpertyKey);
- (void)setMyCustomProperty:(id)myCustomProperty
& & objc_setAssociatedObject(self, MyObjectMyCustomPorpertyKey, myCustomProperty, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
【367】【评论提示后返回】
[SVProgressHUD showSuccessWithStatus:@"提交成功"];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 *
NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
& & [blockSelf.navigationController popViewControllerAnimated:YES];
【365】【每一组的最新记录:分组之前
select max(FTime),* FROM DynamicInfoTable WHERE FUID =
'd441e1d7-e-4b3232' group by FOrgID,FType order by max(FTime) DESC
【363】【label文字左边距】
UIView *leftview = [[UIView alloc] initWithFrame:frame];
textField.leftViewMode = UITextFieldViewModeA
textField.leftView = //imageView
【362】【返回之前,必须退出键盘】【#pragma mark -
返回提示 //
返回,由于是发布页面,所以要检查
提示 防止误操作 - (void)back:(id)sender { BOOL hasSomething = [self formHasSomething]; if (hasSomething) { //
提示 // 发送请求,删除 UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示"
message:@"您确定要放弃发布并返回吗?" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; alertView.confirmBlock
= ^(){ // 调用父类的返回 [super back:sender]; }; [alertView show]; }else{ [self.view endEditing:YES]; [super back:sender]; } }】
【358】【3G4G自动下载图片】
#import "UIImageView+Download.h"
// 异步下载图片
#import "UIImageView+WebCache.h"
#import "KLNetworkStatus.h"
#import "KLTools.h"
@implementation UIImageView (Download)
- (void)downloadImgWithUrlString:(NSString *)urlString placeHolderImgName:(NSString
*)placeHolderImgName
& & if (!(urlString.length &
& & & & //没有图片,直接使用默认图
& & & & self.image = [UIImage
imageNamed:placeHolderImgName];
& & & & return;
& & NSURL *url = [NSURL
URLWithString:urlString];
& & // 1.先从缓存中取,如果缓存中有:直接设置
& & SDWebImageManager *manager = [SDWebImageManager
sharedManager];
& & BOOL isImgAlreadyExists = [manager
cachedImageExistsForURL:url];
& & if (isImgAlreadyExists) {
& & & & UIImage *image = [manager.imageCache
imageFromDiskCacheForKey:urlString];
& & & & [self
setImage:image];
& & & & return;
& & // 2.如果缓存中没有,如果是WIFI,下载
& & BOOL isWifi = [[KLNetworkStatus
sharedKLNetworkStatus] isReachableViaWifi];
& & if (isWifi) {
& & & & [self
sd_setImageWithURL:url placeholderImage:[UIImage
imageNamed:placeHolderImgName]];
& & & & return;
& & // 3.如果是3G/4G,则要再进行判断用户是否开启了
& & BOOL isWWAN = [[KLNetworkStatus
sharedKLNetworkStatus] isReachableViaWWAN];
& & if (isWWAN) {
& & & & BOOL isAllowDownload = [KLTools
isNetworkDownloadSet];
& & & & if (isAllowDownload) {
& & & & & & [self
sd_setImageWithURL:url placeholderImage:[UIImage
imageNamed:placeHolderImgName]];
& & & & & & return;
【348】【判断是否安装weixin】
[WXApi isWXAppInstalled]方法无效
使用下面这个
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weixin://"]])
& & NSLog(@"OK weixin://");
【347】【导航标题】【self.navigationItem.title =
@"发布";】
【346】【xib中的cell无故多出一个半透明灰灰的40高、300宽的label,通过po打印,发现是两个label,猜测是contentLabel和detailLabel】
产生原因:是由于在xib选择了一次cell的accessory为detail,结果
在xib代码中
添加了两个label,
因此,即使 再次将accessory选择为no,那两个label依然在xib代码中。。。。
(lldb) po self
(lldb) po self.contentView
; layer = &
(lldb) po [self.contentView subviews]
&__NSArrayM 0x6ffb850&(
【345】【正则,表情匹配{:001:}对应的是@"\\{:\\d\\d\\d:\\}",注意括号都要转义】
@"\\{:\\d\\d\\d:\\}"反解析
+(NSString *) FContentPrettyFaceText:(NSString *)faceText
& & NSString *str = faceT
& & NSString *pattern = @"\\{:\\d\\d\\d:\\}";
& & NSError *error = NULL;
& & //定义正则表达式
& & NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:&error];
& & //使用正则表达式匹配字符
& & NSArray *arr = [regex & matchesInString:str options:0 range:NSMakeRange(0, [str length])];
& & NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"facesDic.plist" ofType:nil]];
& & if (arr.count !=
& & & & for (long i = arr.count -
1; i &= 0; i--) {
& & & & & & NSTextCheckingResult *result = arr[i];
& & & & & & NSRange range = [result range];
& & & & & & // 开始位置比如:9
& & & & & & int loc = range.
& & & & & & // 长度固定是 7
& & & & & & int len = range.
& & & & & & // {:067:}
& & & & & & NSString *subStr = [str substringWithRange:range];
& & & & & & NSString *key = [subStr substringWithRange:NSMakeRange(2,
& & & & & & // key:067
& & & & & & NSString *value = [dict objectForKey:key];
& & & & & & // [爱心]
& & & & & & // 首
& & & & & & NSString *head = [str substringToIndex:loc];
& & & & & & // 尾
& & & & & & NSString *tail = [str substringFromIndex:loc + len];
& & & & & & str = [NSString stringWithFormat:@"%@%@%@",head,value,tail];
& & return
【343】【奇怪的bug】
问题描述:
1、tableView是通过IB,并且有自动布局;
2、headView是通过代码创建的
3、给tableView加headView,没有问题
4、给tableView加footerView,当用代码创建时,也没有问题
5、但是:当footerView是用自动布局时,tableView首次展示时,footView高度为0;
但是,当jump到一个控制器,并且再次返回时,tableView再次显示,此时footView高度正常了。。。
问题原因:
猜测是:tableView的自动布局影响的
解决方法:
当前 想到的是:线程延迟几秒再给tableView设置footView
self.tableView.tableHeaderView =
self.headV
_footerView = [RowView RowView];
// 这里加个延迟,不然会高度为0,应该是自动布局导致的问题
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 *
NSEC_PER_SEC)),dispatch_get_main_queue(), ^{
& & kStrongSelf
& & strongSelf.tableView.tableFooterView = _footerV
& & [UIView animateWithDuration:5 animations:^{
& & & & [strongSelf.view layoutIfNeeded];
& & & & [strongSelf.tableView layoutIfNeeded];
【342】【只要约束改变后,就要手动刷新对应的view】
_topView.bigImgHeightConstraint.constant =
[UIView animateWithDuration:0.3 animations:^{
& & [self.view layoutIfNeeded];
& & [_topView layoutIfNeeded];
【340】【IB控件用weak,String用copy,delegate用weak,block用copy,对象类型用Strong,基本类型用assign】
@property (nonatomic,weak)
IBOutlet UILabel *
- (IBAction)xxxBtnClicked:(UIButton *)
【335】【label图文混排CBEmotionView】【
使用core text 和 core graphics
实现的文字与表情图片的并排绘制】
【334】【Localizable.strings】
//& Localizable.strings
&本地资源文件
//& Created by beyond on 15/3/19.
//& Copyright (c) 2015年 beyond. All rights reserved.
"appName"="XXX";
"login_now"="立即登录";
"vip_showmsg"="请联系您孩子的班主任开通VIP服务";
NSString *str = NSLocalizedString(@"vip_showmsg",
UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:str delegate:self cancelButtonTitle:@"关闭"
destructiveButtonTitle:@"购买VIP" otherButtonTitles:@"联系客服",
[sheet showInView:self.view];
【333】【禁用单个页面手势滑动返回功能】
在有的时候,我们不需要手势返回功能,那么可以在页面中添加以下代码:
- (void)viewDidAppear:(BOOL)animated
& & [super viewDidAppear:animated];
& & // 禁用 iOS7
& & if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
& & & & self.navigationController.interactivePopGestureRecognizer.enabled =
- (void)viewWillDisappear:(BOOL)animated
& & [super viewWillDisappear:animated];
& & // 开启
& & if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
& & & & self.navigationController.interactivePopGestureRecognizer.enabled =
#define KLNavigationBarHidden [self.navigationController setNavigationBarHidden:YES animated:YES];
#define KLNavigationBarShow [self.navigationController setNavigationBarHidden:NO animated:YES];
【332】【反斜杠】
在吗 NSString 如何表示反斜杠呀 \
NSString *path = @"main\";
打一个错误, \和&挨一起就出错,打两个 NSString *path =
@"main\\";可以,但是后面
[path appendString @"d盘"];以后,
实际的path内容为"main\\d盘"
怎么弄一个单反斜杠呀??
NSString *str = [NSString stringWithFormat:@"%@\\%@",@"main",@"d盘"];
NSLog(@"str:%@",str);
我发现了,这是个显示的问题,在Debuger Console里可以正常显示,在调试中却显示成两个斜杠,转意字符应该是好使的,即NSString中,""\\"",就是
一个"\" 的转意字符,和c的和c++的一样,只是调试时显示的值有bug罢了。
【331】【data--&string--&OC对象】
(lldb) po data
223a3530 302c2245
72726f72 4d657373
3a22e794 a8e688b7 e4b88de5 ad98e59c a8e6e7 a081e994
99e8afaf efbc8122 2c22436f
6e74656e 74223a6e
(lldb) po responseString
{"StatusCode":500,"ErrorMessage":"用户不存在或密码错误!","Content":null}
2015-05-21
14:26:31.952 JZH[161:60b]
__70-[NetRequest initWithAction:userId:password:otherParam:completeBlock:]_block_invoke [Line
209] responseObject ==== {
& & Content = "";
& & ErrorMessage = "\U\U4e0d\U5b58\U\U5bc6\U\U8bef\Uff01";
& & StatusCode = 500;
【330】【label中显示表情】【查看原文】
【327】【金额用NSNumber接收,必须strong引用
否则 内存释放,崩掉】
@property (nonatomic,strong) NSNumber *orderP
double currentPrice = [model.FCurrentPrice doubleValue];
_topView.currentLabel.text = [NSString stringWithFormat:@"¥%.02lf",currentPrice];
【326】【xcode6建分类】【左上角file菜单---》new
File----&Objective-c File----&Category】
【325】【通知】
- (void)xxxNoti:(NSNotification *)noti
& & //获取键盘的高度
& & NSDictionary *dict = [noti userInfo];
- (void)dealloc
& & [[NSNotificationCenter defaultCenter]removeObserver:self];
// 监听支付成功
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(paySuccess) name:@"notificationCenter_paySuccess"
object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"notificationCenter_paySuccess" object:nil];
【324】【webview死活不执行js代码】
webview加载本地html需要时间,同时,通过id向服务器获取详情也需要时间,因此:很可能当服务器已经获取到detail信息时,本地的html尚未加载完毕,故出现上述情况
【323】【UIAlertView+Block】
typedef void (^UIAlertViewBlock)(UIAlertView *alertView, NSInteger buttonIndex);
typedef void (^ConfirmBlock)(void);
@interface UIAlertView(Block)
@property (nonatomic,copy)ConfirmBlock confirmB
@property (nonatomic,copy)UIAlertViewBlock clickB
// 必须手动用运行时绑定方法
- (void)setConfirmBlock:(ConfirmBlock)confirmB
- (ConfirmBlock)confirmB
- (void)setClickBlock:(UIAlertViewBlock)clickB
- (UIAlertViewBlock)clickB
@end====================
#import "UIAlertView+Block.h"
@implementation UIAlertView(Block)
必须手动用运行时绑定方法
- (void)setConfirmBlock:(ConfirmBlock)confirmBlock
& & objc_setAssociatedObject(self,
@selector(confirmBlock), confirmBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
& & if (confirmBlock ==
& & & & self.delegate =
& & else {
& & & & self.delegate =
- (ConfirmBlock)confirmBlock
& & return objc_getAssociatedObject(self,
@selector(confirmBlock));
&必须手动用运行时绑定方法
- (void)setClickBlock:(UIAlertViewBlock)clickBlock
& & objc_setAssociatedObject(self,
@selector(clickBlock), clickBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
& & if (clickBlock ==
& & & & self.delegate =
& & else {
& & & & self.delegate =
- (UIAlertViewBlock)clickBlock
& & return objc_getAssociatedObject(self,
@selector(clickBlock));
#pragma mark - UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
& & if (buttonIndex ==
& & & & // 确定
& & & & if (self.confirmBlock) {
& & & & & & // self.confirmBlock(self, buttonIndex);
& & & & & & self.confirmBlock();
& & } else {
& & & & // 取消或其他
& & if (self.clickBlock) {
& & & & self.clickBlock(self, buttonIndex);
@end====================
// 发送请求,删除
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"您确定要放弃发布并返回吗?"
delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"确定",
alertView.confirmBlock = ^(){
& & // 调用父类的返回
& & [super doBack:sender];
[alertView show];
【322】【按钮,左图
#import "OperationBtn.h"
#define kMargin 5
@implementation OperationBtn
- (void)setHighlighted:(BOOL)highlighted
& & // do nothing 就是取消默认的高亮状态
- (CGRect)imageRectForContentRect:(CGRect)contentRect
& & // 图片等宽高(15,整个按钮是25,图片左上边距全是5)
& & CGFloat wh = contentRect.size.height -
kMargin - kMargin ;
& & CGRect rect =
CGRectMake(kMargin,
kMargin, wh, wh);
& & return
- (CGRect)titleRectForContentRect:(CGRect)contentRect
& & // 文字居右 (图片15*15)
& & CGFloat wh = contentRect.size.height -
kMargin - kMargin;
& & CGFloat x =
kMargin + 15 +
& & CGFloat y =
kMargin + 3;
& & CGRect rect =
CGRectMake(x, kMargin,contentRect.size.width - x, wh);
& & return
- (void) setEnabled:(BOOL)enabled
& & DLog(@"setEnabled方法:%d",enabled& );
& & [super
setEnabled:enabled];
【321】【No matching provisioning profiles found】
问题:Your build settings specify a provisioning profile with the UUID &dedebf56-8f41-4af9-aeb8-5ec59fe02fedbeyond&,
however, no such provisioning profile was found.& Xcode can resolve
this issue by downloading a new provisioning profile from the Member
解决方法:
targets---build settings---- code signing----provisioning profile----debug
【320】【自动布局按钮排列】【先全部与父类对齐,然后设置一下乘积因子】【查看原文】
【315】【webview执行js函数注意事项】
url has prefix 判断时,要注意ios统一加http://并且注意大小写哦~~~
字符串参数要用单引号
true用数字1
并且jsonString必须使用NSJSONReadingMutableLeaves,
不能使用pretty风格,如下所示:
NSData *data = [NSJSONSerialization dataWithJSONObject:bigDict options:NSJSONReadingMutableLeaves error:nil];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
【314】【奇怪的问题】【在cell的xib文件中
添加了一个控件如label,并且IBOutlet连线,但是:运行的时候该label却没有初始化显示为nil】
【312】【JSBadgeView
是一个可定制的在视图上显示徽章的 iOS 组件】
【311】【iphone6截屏750 X
【310】【框架请求失败,提示405不支持POST,只allow GET】
位于类:AFHTTPRequestOperation.m
位于方法:
- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation,
id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
具体代码:
id responseObject =
self.responseO
if (self.error) {
& & if (failure) {
& & & & dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(),
self.completionQueue ?: dispatch_get_main_queue(), ^{
& & & & & & failure(self,
self.error);
& & & & });
& & if (success) {
& & & & dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(),
self.completionQueue ?: dispatch_get_main_queue(), ^{
& & & & & & success(self, responseObject);
& & & & });
(lldb) po self.response
{ URL: http://192.168.1.124:555/api/System/GetUserIdentityInfo } { status code: 405, headers {
& & Allow = GET;
& & "Cache-Control" =
"no-cache";
& & "Content-Length" =
& & "Content-Type" =
"application/ charset=utf-8";
& & Date = "Mon, 11 May :47 GMT";
& & Expires = "-1";
& & Pragma = "no-cache";
& & Server = "Microsoft-IIS/7.5";
& & "X-AspNet-Version" =
"4.0.30319";
& & "X-Powered-By" =
"ASP.NET";
(lldb) po self.responseObject
& & Message = "The requested resource does not support http method 'POST'.";
【309】【关于xcode自己revoke(吊销)certificate(证书)的问题】
原因:新target运行项目的时候,提示找不到描述文件;xcode提议
自动fix issue
描述:这时候,xcode会 revoke(吊销)原来的certificate(证书),因此,与原来证书相关联的描述文件,全部会失效;
解决方法:正确的做法是:从团队其他人员拷贝描述文件到本机,双击导入;在xcode项目配置的设置中
选择刚才导入的描述文件,进而选择code sign identity
【308】【方形图片变圆】
70 * 70的话,圆角只要设置成half即可,即:35
// 从xib中加载
实例化一个SynClassCell对象
+ (ParentDetailTopView *)ParentDetailTopView
& & // mainBundel加载xib,扩展名不用写.xib
& & NSArray *arrayXibObjects = [[NSBundle mainBundle] loadNibNamed:@"ParentDetailTopView" owner:nil options:nil];
& & ParentDetailTopView *topView = [arrayXibObjects firstObject];
& & topView.headImgView.layer.masksToBounds =
& & topView.headImgView.layer.cornerRadius =
& & return& topV
【305】【scrollView滚动范围】【//
重置contentView的滚动范围必须大于其bounds的高,才能滚动】
【304】【cell侧滑ime删除】
1.dataSource的方法:
- (void)tableView:(UITableView
*)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
此方法就是给一个空的实现滑动也会出现删除按钮!!
2. 必须先删除数据源
[blockSelf.arrayData removeObjectAtIndex:indexPath.row];
// 再删除view
[blockSelf.tableView
deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
[blockSelf.tableView reloadData];
【301】【弹出动画】
注意在viewDidAppear调用
- (void)addKeyAnimation
& & CAKeyframeAnimation *
& & animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
& & animation.duration = 0.5;
& & animation.delegate = self;
& & animation.removedOnCompletion = YES;
& & animation.fillMode = kCAFillModeF
& & NSMutableArray *values = [NSMutableArray array];
& & [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1,
0.1, 1.0)]];
& & [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2,
1.2, 1.0)]];
& & [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9,
0.9, 0.9)]];
& & [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0,
1.0, 1.0)]];
& & animation.values =
& & [_contentView.layer addAnimation:animation forKey:nil];
【299】【ineligible devices】
iphone 6 with
8.3系统,连接到xcode
提示:ineligible devices
原因:xcode版本太低
解决办法:
换成xcode 6.1
==============
Xcode 6.1 update. The
6.0.1 does't support iOS 8.1.
【查看原文】
【298】【二次包装过程】
将一个字典,包装成一个大的大典,再转成jsonString
// 二次包装过程
NSArray *modelArr = [MarkModel objectArrayWithKeyValuesArray:dataArr];
MarkBigModel *bigModel = [[MarkBigModel alloc]init];
bigModel.FScore = 5;
NSArray *dictArray = [MarkModel keyValuesArrayWithObjectArray:modelArr];
bigModel.MciMcBusiSiteRemarkItems = dictA
bigModel.RemarkCount = modelArr.
转 字典,之后就可以用字典
转 jsonString
NSDictionary *bigDict = bigModel.keyV
通过NSJSONSerialization 转成Data,再从Data
转成jSON string,会有反斜线
NSData *data = [NSJSONSerialization dataWithJSONObject:bigDict options:NSJSONReadingMutableLeaves error:nil];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
【297】【OC的字典转成jsonString】
// 重要说明:content此时已经从json串
转成了OC的字典 1种是
通过JSONKIT,可将字典转成json字符串;
// self.jsonString = [(id)content JSONString];
通过NSJSONSerialization 转成Data,再从Data
转成jSON string
NSData *data = [NSJSONSerialization dataWithJSONObject:content options:NSJSONWritingPrettyPrinted error:nil];
self.jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
【296】【appdelegate中的支付回调1】
// pay ---- 3
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
& & [Pingpp handleOpenURL:url withCompletion:nil];
& & [[NSNotificationCenter defaultCenter]postNotificationName:@"notificationCenter_userPayOrNot" object:nil];
& & return&
& & (lldb) po url
jzh://pingpp?result=success
& & (lldb) po sourceApplication
& & com.apple.mobilesafari
& & (lldb) po annotation
& & (lldb)
【293】【代码改约束】
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 *
NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
& & //& & & & //& &
当事件触发时,改变其constant值,然后调用约束所在的对象的 layoutIfNeeded方法,固定的~
& & //& & & & _topView.collectionViewHeightConstraint.constant = 50;
& & //& & & & //& & self.leftMarginConstraint.constant = 100;
& & //& & & & //& & self.widthConstraint.constant = 200;
& & //& & & & [UIView animateWithDuration:2.0 animations:^{
& & //& & & & & & [self.view layoutIfNeeded];
& & //& & & & & & [_topView layoutIfNeeded];
& & //& & & & }];
【292】【cell图片在xib中aspect fit无效,只能用代码调整】
self.img.contentMode = UIViewContentModeScaleAspectF
self.img.clipsToBounds =
【291】【cell分割线设置,其实是tableView的属性separatorStyle】
将UITableView的separatorStyle属性设置为UITableViewCellSeparatorStyleNone即可,如下:
tableView.separatorStyle = UITableViewCellSeparatorStyleN
【289】【隐藏导航条】
// 导航控制器的显示和隐藏【提示,如果使用navigationBarHidden属性,侧滑会出问题】
- (void)viewWillAppear:(BOOL)animated
& & [super viewWillAppear:animated];
& & self.navigationController.navigationBar.hidden =
- (void)viewWillDisappear:(BOOL)animated
& & [super viewWillDisappear:animated];
& & self.navigationController.navigationBar.hidden =
【286】【Cell点击特效
cell.selectionStyle = UITableViewCellSelectionStyleN
【285】【动画特效1】
CAKeyframeAnimation *
animation = [CAKeyframeAnimation
animationWithKeyPath:@"transform"];
animation.duration = 0.5;
animation.delegate = self;
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeF
NSMutableArray *values = [NSMutableArray
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1,
0.1, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2,
1.2, 1.0)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9,
0.9, 0.9)]];
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0,
1.0, 1.0)]];
animation.values =
[_contentView.layer addAnimation:animation forKey:nil];
【284】【url schemes】
工程---&targets---&info---&urlTypes
identifier:& com.sg31.www
url schemes: beyond
下面的为接收到外部调用的时候程序启动,响应方法,在safari输入:beyond://com.sg31.www
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
& & if ([[url scheme] isEqualToString:@"beyond"]) {
& & & & NSLog(@"外部调用成功");
& & return
【283】【iOS开发的一些奇巧淫技】【进入网址】
【282】【auto adjust cell】
viewdidload
tableView.rowHeight = UITableViewAutomaticD
tableView.estimatedRowHeight = 10;
cellForRow
[cell layoutIfNeeded];
【281】【btn得到cell得到table得到row】
while (![btn isMemberOfClass:[self class]]){
& & btn = (UIButton *)[btn superview];
MyProjectCell *cell = (MyProjectCell *)
UITableView *tableView = (UITableView *)
while (![tableView isMemberOfClass:[UITableView class]]){
& & tableView = (UITableView *)[tableView superview];
NSIndexPath *path = [tableView indexPathForCell:cell];
row = path.row;
// 已经弃用,调用外界的控制器的block,并将cell的行号传递过去
// _wannaChangeStatusBlock(row); 调用外界的控制器的block,并将cell的行号传递过去
_wannaChangeStatusBlockExt(row,cell);
【279】【textView占位】
Easy way, just create placeholder text in UITextView by using the following UITextViewDelegate methods:
- (void)textViewDidBeginEditing:(UITextView *)textView
& & if ([textView.text isEqualToString:@"placeholder text here..."]) {
& & & & textView.text = @"";
& & & & textView.textColor = [UIColor blackColor];
//optional
& & [textView becomeFirstResponder];
- (void)textViewDidEndEditing:(UITextView *)textView
& & if ([textView.text isEqualToString:@""]) {
& & & & textView.text = @"placeholder text here...";
& & & & textView.textColor = [UIColor lightGrayColor];
//optional
& & [textView resignFirstResponder];
just remember to set myUITextView with the exact text on creation e.g.
UITextView *myUITextView = [[UITextView alloc] init];
myUITextView.delegate = self;
myUITextView.text = @"placeholder text here...";
myUITextView.textColor = [UIColor lightGrayColor];
//optional
and make the parent class a UITextViewDelegate before including these methods e.g.
@interface MyClass ()
【进入网址】
【274】【nsrange,是
一个结构体,方法:& & & & NSMakeRange(&#NSUInteger loc#&, &#NSUInteger len#&)】
【273】【iOS开发的一些奇巧淫技】【查看原文】
【272】【awakeFromNib】
- (id)initWithFrame:(CGRect)frame
& & self = [super initWithFrame:frame];
& & if (self) {
& & & & // Initialization code
& & return
- (void)awakeFromNib{
& & [super awakeFromNib];
& & NSLog(@"call %s",
__FUNCTION__);
& & self.backgroundColor = [UIColor redColor];
& & // 其他初始化方法
【271】【先对数组统一排序,再进行分组,再组内排序】
// 其他情况,返回是数组
NSMutableArray *contentDictArr = (NSMutableArray *)
DLog(@"返回是数组,长度是 %d",contentDictArr.count);
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// NSArray 转成 NSMutableArray
// 0、对于不启用的,即enabled为0的字典模型,删除掉
NSMutableArray *dictArr = [NSMutableArray
for (NSInteger i =
0; i & contentDictArr. i++) {
& & NSDictionary *dict = contentDictArr[i];
& & if ([[dict objectForKey:@"FEnabled"]intValue] ==
& & & & [dictArr addObject:dict];
// DLog(@"清除未启用的字典后的数组:%@",dictArr);
// 0.1、对于被包含的模块,暂时剔除
NSMutableArray *tempdictArr = [NSMutableArray
for (NSInteger i =
0; i & dictArr. i++) {
& & NSDictionary *dict = dictArr[i];
& & // 如果有值,则说明是某个模块的子模块@"26e8e1-a7d5-6d513c02de39"
& & // 如果没有值,即NSNull,表示是根目录模块,直接展示
& & if ([[dict objectForKey:@"FUpCMID"] class] == [NSNull class]) {
& & & & [tempdictArr addObject:dict];
} 1、对数组按GroupTag排序
NSArray *sortDesc = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"FGroupTag" ascending:YES]];
NSArray *sortedArr = [tempdictArr sortedArrayUsingDescriptors:sortDesc];
// DLog(@"排序后的数组:%@",sortedArr);
&2、对数组进行分组,按GroupTag
// 遍历,创建组数组,组数组中的每一个元素是一个模型数组
NSMutableArray *testGroupArr = [NSMutableArray array];
NSMutableArray *currentArr = [NSMutableArray
// 因为肯定有一个字典返回,先添加一个
[currentArr addObject:sortedArr[0]];
[testGroupArr addObject:currentArr];
// 如果不止一个,才要动画添加
if(sortedArr.count &
& & for (NSInteger i =
1; i & sortedArr. i++) {
& & & & // 先取出组数组中&
上一个模型数组的第一个字典模型的groupID
& & & & NSMutableArray *preModelArr = [testGroupArr objectAtIndex:testGroupArr.count-1];
& & & & NSInteger preGroupID = [[[preModelArr objectAtIndex:0] objectForKey:@"FGroupTag"] intValue];
& & & & // 取出当前字典,根据groupID比较,如果相同则添加到同一个模型数组;如果不相同,说明不是同一个组的
& & & & NSDictionary *currentDict = sortedArr[i];
& & & & NSInteger groupID = [[currentDict objectForKey:@"FGroupTag"] intValue];
& & & & if (groupID == preGroupID) {
& & & & & & [currentArr addObject:currentDict];
& & & & }else{
& & & & & & // 如果不相同,说明
有新的一组,那么创建一个模型数组,并添加到组数组testGroupArr
& & & & & & currentArr = [NSMutableArray array];
& & & & & & [currentArr addObject:currentDict];
& & & & & & [testGroupArr addObject:currentArr];
// 3、遍历
对每一组 进行排序
NSMutableArray *tempGroupArr = [NSMutableArray
for (NSArray *arr in testGroupArr) {
& & // NSArray *sortDesc = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"FOrder" ascending:YES]];
& & NSArray *tempArr = [arr sortedArrayUsingComparator:^NSComparisonResult(id obj1,
id obj2) {
& & & & if([[obj1 objectForKey:@"FOrder"]intValue] & [[obj2 objectForKey:@"FOrder"]intValue]){
& & & & & & return NSOrderedA
& & & & if([[obj1 objectForKey:@"FOrder"]intValue] & [[obj2 objectForKey:@"FOrder"]intValue]){
& & & & & & return NSOrderedD
& & & & return NSOrderedS
& & [tempGroupArr addObject:tempArr];
testGroupArr = tempGroupArr;
DLog(@"封装好的group数组:%@",testGroupArr);
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// testGroupArr 将封装好的字典数组缓存起来,以便下次调用 userDefault_localGroupArr
// 根据用户上次选择的,展示
NSUserDefaults *userDefault = [NSUserDefaults
standardUserDefaults];
[userDefault setBool:YES forKey:@"userDefault_hasCached_moduleDictArr"];
NSString *jsonStr = testGroupArr.JSONS
DLog(@"没有网络的时候用:jsonStr:%@",jsonStr);
[userDefault setObject:jsonStr forKey:@"testGroupArr_jsonStr"];
[userDefault sync
&【270】【自动布局scrollView】
&contentSize 必须明确指定,如label距离下方多少,距离右边多少,这样才可以
让scrollView计算出contentSize
&【查看原文】
&【267】【inDatabase: was called reentrantly on the same queue, which would lead to a deadlock】
&在使用时,如果在queue里面的block执行过程中,又调用了 indatabase方法,则会检查
是不是同一个queue,如果是同一个queue会死锁;原因很简单:
放了一个block,该block又在
本队列 后面放了一个 block;
&从而:前一个block
里面 调用了
后一个block,必须等后一个block执行完成了,
&前一个block才会
&而后一个block想要执行,则又必须先等
前一个block出队列;
死锁!!!!
&解决方法:在indatabase的block中,不要再调用indatabase方法
&[[[DBHelper shareInstance] dbQueue]inDatabase:^(FMDatabase *db){
& & isSuccess = [self.helper update4Table:TB_User_Friend withArgs:args where:where];
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&- (void)inDatabase:(void (^)(FMDatabase *db))block {
&& & /* Get the currently executing queue (which should probably be nil, but in theory could be another DB queue
& & & * and then check it against self to make sure we're not about to deadlock. */
&& & FMDatabaseQueue *currentSyncQueue = (__bridge
id)dispatch_get_specific(kDispatchQueueSpecificKey);
&& & assert(currentSyncQueue !=
self && "inDatabase: was called reentrantly on the same queue, which would lead to a deadlock");
&【261】【ios_xib_preview预览】
&右上方----show the assistant edit ----
选择新窗口中manual最下方的Preview
&【258】【应该竖屏,仅在视频播放页面横屏】
&在app delegate中,启动时,
&[userDefault setBool:NO forKey:@"userDefault_isAllowLandscape"];
&[userDefault synchronize];
&在app delegate中,通过一个本地保存的key进行判断,是否进行横屏
&- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
& & // 全局的设置:允许竖屏+横屏
& & NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
& & BOOL isAllowLandscape = [userDefault boolForKey:@"userDefault_isAllowLandscape"];
& & if (isAllowLandscape) {
& & & & return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskL
& & } else {
& & & & return UIInterfaceOrientationMaskP
&在视频播放控制器中,更改本地保存的key即可
&【257】【模拟器上面
播放视频崩溃】
&iphone 4s&
8.0系统的模拟器上面
播放视频:
11:44:39 [jun] rtcreporting[57158] : logging starts...
11:44:39 [jun] rtcreporting[57158] : setMessageLoggingBlock: called
&在模拟器上面播放视频
&解决办法:
&去掉全局断点,这是一个bug
&【256】【iphone真机死活不旋转】
&死活不走代理方法:
&- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
& & return (interfaceOrientation == UIInterfaceOrientationPortrait
& & & & & & || interfaceOrientation == UIInterfaceOrientationLandscapeLeft
& & & & & & || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
&原因可能是:手机上拉快速设置栏中:竖排方向锁定
&【255】【导航返回按钮】
&UIButton* btn = [[UIButton alloc] initWithFrame:CGRectMake(0,
0, image.size.width+10,
&btn.showsTouchWhenHighlighted = YES;
&[btn setImage:image forState:UIControlStateNormal];
&[btn addTarget:theTarget action:sel forControlEvents:UIControlEventTouchUpInside];
&UIBarButtonItem *backBtn = [[UIBarButtonItem alloc] initWithCustomView:btn];
&backBtn.tag = 9528;
&vc.navigationItem.leftBarButtonItem = backB
&【254】【ios_VLC】
&VLC for iOS
&关于VLC配置问题,根据个人经验整理了一下,希望能帮到需要的朋友。
&官网链接:https://wiki.videolan.org/IOSCompile/
&百度云盘链接:http:///s/1bnEOXPH
&配置说明(百度云盘)
&官网按照说明操作就可以了只是下载的地址是个谷歌的什么网站,所以你懂得。
&百度云盘下载下来后需要配置下文件VLC/ios/External
这个文件夹下面有六个文件(快捷方式):MediaLibraryKit,MobileVLCKit,PLCrashReporter,QuincyKit,gtl,upnpx
&重新配置下这六个文件路径就可以用了,vlc源码是区分真机和模拟器的
&终端配置路径
&1、在终端进入External文件夹
&2、ln -s -f是终端修改文件路径的,关于终端命令不懂的朋友请百度,在此就不班门弄斧了。
&真机就用Release-iphoneos,模拟器就用Release-iphonesimulator
&ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/MediaLibraryKit/build/Release-iphoneos MediaLibraryKit
&ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/VLCKit/build/Release-iphoneos MobileVLCKit
&ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/PLCrashReporter/build/Release-iphoneos PLCrashReporter
&ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/QuincyKit/client/iOS/QuincyLib/build/Release-iphoneos QuincyKit
&ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/GDrive/build/Release-iphoneos gtl
&ln -s -f /Users/stlink/Desktop/VLC/ios/ImportedSources/upnpx/projects/xcode4/upnpx/build/Release-iphoneos upnpx
&3、路径正确的话就没问题了,ls -l
查看文件路径
&修改完成后就可以启动了VLC/iOS/VLC
for iOS.xcodeproj
&注意:我有时候配置正确路径但是文件还是报错,这种情况的话解压重新搞吧,暂时不知道怎么处理。
&SimplePlayback
&这个是VLC在线播放的一个demo,路径:VLC/ios/ImportedSources/VLCKit/Examples_iOS/SimplePlayback
&项目直接拷贝出来不能用的,要配置下。
&libMobileVLCKit.a 这个demo用到这个静态库。静态库区分真机和模拟器的。静态库我不太懂怎么配置,搞了几次没搞定
&不过有另外的办法MobileVLCKit.framework这个不区分真机和模拟器的。
&路径:VLC/ios/ImportedSources/VLCKit/build
&注意:Deployment target
&最后希望能帮到需要的朋友,不懂得可以联系我,qq:,加好友请说明谢谢,由于工作原因可能无法及时回复请见谅,而且我也是刚接触vlc。
&关键词:iOS VLC
&MediaLibraryKit项目中的Search paths使用相对路径就可以了。
&Header Search Paths --&& ../../External/MobileVLCKit/include
&Library Search Paths --& ../../External/MobileVLCKit
&MediaLibraryKit项目中相对路径$(SRCROOT)得到的值是/XXX/XXX/VLC/ios/ImportedSources/MediaLibraryKit,而不是想象中的/XXX/XXX/VLC/ios/
&多谢LZ的奉献~~~
&【查看原文】
&【253】【ios_VLC】【查看原文】
&【247】【dispatch_after延时改变约束】
&dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 *
NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
& & //& & 当事件触发时,改变其constant值,然后调用约束所在的对象的
layoutIfNeeded方法,固定的~
& & _topView.collectionViewHeightConstraint.constant =
& & //& & self.leftMarginConstraint.constant = 100;
& & //& & self.widthConstraint.constant = 200;
& & [UIView animateWithDuration:2.0 animations:^{
& & & & [self.view layoutIfNeeded];
& & & & [_topView layoutIfNeeded];
&【246】【this class is not key value coding-compliant
for the key HeightConstraint】
&this class is not key value coding-compliant
for the key HeightConstraint
&在IB上拖线时的时候,有多的
,删除掉即可
&【227】【ios_数组中放枚举】
&NSInteger & _btnTagArr[4] = {ContactSelectBtnChatting,ContactSelectBtnTel,isTeacher?ContactSelectBtnLeave:ContactSelectBtnDetail};
&【226】【实时获得webView的contentSize】
&iOS 如何计算UIWebView的ContentSize
&首选要等UIWebView加载内容后,然后在它的回调方法里将webview的高度Height设置足够小,就设置为1吧,因为这样才能用
&sizeThatFits才能计算出webview得内容大小
&- (void)webViewDidFinishLoad:(UIWebView *)aWebView {
&& & CGRect frame = aWebView.
&& & frame.size.height = 1;
&& & aWebView.frame =
&& & CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero];
&& & frame.size = fittingS
&& & aWebView.frame =
&& & NSLog(@"size: %f, %f", fittingSize.width, fittingSize.height);
&UIWebView计算高度 (2013-10-09
14:48:39)转载▼
&标签: uiwebview
高度 计算 sizethatfits
分类: ios
&- (void)webViewDidFinishLoad:(UIWebView *)webView{
&& & float height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetH"] floatValue];
&& & //document.body.scrollHeight
&- (void) webViewDidFinishLoad:(UIWebView *)webView
& & CGRect frame = webView.
& & CGSize fittingSize = [webView sizeThatFits:CGSizeZero];
& & frame.size = fittingS
& & webView.frame =
&- (void)viewDidLoad {
&& & [super viewDidLoad];
&& & webview.delegate = self;
&& & [webview loadHTMLString:@"
& & & fdasfda
& & & " baseURL:nil];
& & & - (void)webViewDidFinishLoad:(UIWebView *)webView
& & & & & NSString *output = [webview stringByEvaluatingJavaScriptFromString:@"document.getElementByIdx_x_x_x("foo").offsetH"];
& & & & & NSLog(@"height: %@", output);
& & & 【224】【popping动画演示】【进入网址】
& & & 【223】【第3方集成支付】【进入网址】
& & & 【222】【IOS7新特性之XCODE】【进入网址】
& & & 【218】【变量名和类型相同时的异常错误】
& & & FilterCtrl *FilterCtrl = [[FilterCtrl alloc]init];
& & & 这样命名变量,会报错,提示:没有声明alloc方法。。。。
& & & 【217】【定义枚举】
& & & // 定义一个枚举
& & & typedef
& & & & & // 返回按钮
& & & & & FootViewBtnTypeBack,
& & & & & // 我的
& & & & & FootViewBtnTypeMine,
& & & & & // 写评论
& & & & & FootViewBtnTypeWriteComment,
& & & & & // 查看评论
& & & & & FootViewBtnTypeReadComment,
& & & & & // 关注、取消关注
& & & & & FootViewBtnTypeAttention,
& & & & & // 更多按钮
& & & & & FootViewBtnTypeMore
&& & & & &
& & & } FootViewBtnT
& & & 【216】【scrollView滚动方向】
& & & 向上拉时,contentOffset.y为正
& & & 向下拉时,contentOffset.y为负
& & & 滚动判断用到的变量:
& & & typedef
void (^ScrollBlock)(void);
& & & // 向上滚动时的block
& & & @property (nonatomic,strong) ScrollBlock scrollUpB
& & & // 向下滚动时的block
& & & @property (nonatomic,strong) ScrollBlock scrollDownB
& & & // 滚动判断
& & & CGFloat startY;
& & & BOOL isNowUp;
& & & BOOL isD
& & & BOOL isUserD
#pragma mark - 滚动,新增,显示,隐藏
& & & - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
& & & & & // 开始时,标记置真
& & & & & isUserDrag = YES;
& & & & & // 记录一下开始滚动的offsetY
& & & & & startY = scrollView.contentOffset.y;
& & & - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
& & & & & // 结束时,置flag还原
& & & & & isUserDrag = NO;
& & & - (void)scrollViewDidScroll:(UIScrollView *)scrollView
& & & & & // 只有用户drag时,才进行响应
& & & & & if(isUserDrag){
& & & & & & & // 实时
& & & & & & & // 判断一下,并发出通知
& & & & & & & CGFloat newY = scrollView.contentOffset.y;
& & & & & & & if(startY - newY &0){
& & & & & & & & & //
说明向上滚动
& & & & & & & & & if(!isNowUp){
& & & & & & & & & & & //通过block告诉外部控制器
& & & & & & & & & & & if(_scrollUpBlock){
& & & & & & & & & & & & & _scrollUpBlock();
& & & & & & & & & & & }
& & & & & & & & & & & isNowUp = YES;
& & & & & & & & & & & isDown = NO;
& & & & & & & & & }
& & & & & & & }else
if(startY - newY&0){
& & & & & & & & & //
说明向下滚动
& & & & & & & & & if(!isDown){
& & & & & & & & & & & //通过block告诉外部控制器
& & & & & & & & & & & if(_scrollDownBlock){
& & & & & & & & & & & & & _scrollDownBlock();
& & & & & & & & & & & }
& & & & & & & & & & & isDown = YES;
& & & & & & & & & & & isNowUp = NO;
& & & & & & & & & }
& & & & & & & }
& & & & & & & startY = scrollView.contentOffset.y;
& & & & & }
&& & & & &
& & & - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
&& & & & &
& & & & & if (_scrollDownBlock &&
self.tableView.contentSize.height - (self.tableView.contentOffset.y+self.tableView.bounds.size.height) &
& & & & & & & _scrollDownBlock();
& & & & & & & return;
& & & & & }
& & & & & if(_scrollUpBlock){
& & & & & & & _scrollUpBlock();
& & & & & & & isNowUp = YES;
& & & & & & & isDown = NO;
& & & & & & & return;
& & & & & }
&& & & & &
& & & 【214】【MJRefresh的github】【点击下载】
& & & 【211】【如何设置appIcon】【点击targets---&general---&use asset catalog】【查看原文】
& & & 【210】【DLog】
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#define DLog(...)
& & & 【209】【特效滤镜】【点击下载】
& & & 【208】【往模拟器里添加照片的最简单的方法:直接把照片拖到模拟器上就可以了】
& & & 【202】【OCR图像识别】【可以实现类似taobao客户端扫描银行卡号的功能】【查看原文】
& & & 【201】【Not a git repository】
&& & & & & & & & & & & fatal: Not a git repository (or any of the parent directories): .git
& & & 解决办法:git init
& & & 【199】【第3方_VKPlayer播放器】【进入网址】
& & & 【198】【pod install报错
版本不兼容】【VKVideoPlayerTests` (iOS
5.0) is not compatible with `Expecta (0.3.2)` which,解决方法:将项目deployment改高一点如:6.1即可】
& & & 【197】【CardI扫描卡没有反应】【 card.io only scans
5 card types (MasterCard, Visa, Discover, American Express, JCB),后面是stackoverflow的解答】【进入网址】
【查看原文】
& & & 【196】【无法在真机运行,XCode提示ineligible device】【解决办法:在targets----&build
settings----&iOS Deployment Target选择iOS6.1或者更低的版本】
& & & 【195】【正则NSPredicate检查中文】
& & & // 检查汉字,YES代表全是汉字
& & & - (BOOL)isHanziCheck:(NSString *)str
& & & & & //& & NSString *regex = @"[a-zA-Z\u4e00-\u9fa5][a-zA-Z0-9\u4e00-\u9fa5]+";
& & & & & NSString *regex = @"[\u4e00-\u9fa5]{2,8}";
& & & & & NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
& & & & & if(![pred evaluateWithObject: str]){
& & & & & & & /*
&& & & & & & & //此动画为在顶上显示文字
&& & & & & & & [MPNotificationView notifyWithText:@"昵称只能由中文、字母或数字组成"
&& & & & & & & andDuration:0.5];
&& & & & & & & */
& & & & & & & return
& & & & & }
& & & & & return
& & & 【186】【判断包含字符串NSRange】
& & & NSRange range = [requestURLStr rangeOfString:@""];
& & & if (range.length &
& & & 或者
& & & if(range.location !=NSNotFound){
& & & 【184】【SDWebImage默认会永久缓存一张图片】【但如果同一个url下的图片是变化的,那暂时想到的是用内存缓存,[imgView
sd_setImageWithURL:url placeholderImage:imgPlace options:SDWebImageCacheMemoryOnly];】
& & & 【180】【URL Schemes打开app】【进入网址】
& & & 【179】【URL Schemes打开app】【进入网址】
& & & 【165】【UILabel显示:标题。。。张数,设置NSLineBreakByTruncatingMiddle即可】
& & & 【162】【UserDefault写入的目录是:/var/mobile/Applications/Library/Preferences/com.beyond.testUserD.plist】
& & & 【161】【自动定位:中国浙江省杭州市西湖区西溪街道文二路下宁巷3-1号,
中国浙江省杭州市西湖区西溪街道文二路下宁巷3-1号 @ &+30.,+120.&
+/- 100.00m, region (identifier &+30.,+120.& radius
49.29) &+30.,+120.& radius
& & & 【160】【自动定位:No.
3-1 Xianing Alley, No.
3-1 Xianing Alley, Wen'er Road& Xixi Residential District, Xihu Hangzhou, Zhejiang China @ &+30.0.& +/- 100.00m, region
(identifier &+30.0.& radius 49.29) &+30.0.& radius 49.29m】
& & & 【80】【打开模拟器】【XCode--&Open Developer Tool--&Simulator】
& & & 【79】【Unable to determine simulator device to boot】【原因:XCode不知道选择哪一个模拟器去运行app.
解决方法:退出所有XCode和模拟器,若还不行,就重启mac】
& & & 【78】【错误installAppearanceSwizzlesForSetter】【原因是:[[UINavigationBar appearance]
setTranslucent:NO]在iOS8中才有,
解决办法:#define IOS8 [[[UIDevice currentDevice] systemVersion] floatValue] &=
8.0 & & if(IOS8 && [UINavigationBar conformsToProtocol:@protocol(UIAppearanceContainer)])
{ & & & & [[UINavigationBar appearance] setTranslucent:NO]; & & }】
& & & 【71】【判断tableView滚动到了最后一行】【self.tableView.contentSize.height
=contentOffset+bounds.size.height】
& & & 【61】【Cell中,先执行这个- (id)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier,再执行这个-(void)awakeFromN】
& & & 【60】【AutoLayout中,如何让ImageView保持固定的宽高比?例如1:1】【先将imageViewframe手动写成:宽20,高20,再勾选Aspect
Ratio添加宽高比约束】【查看原文】
相关搜索:
相关阅读:
相关频道:
IOS教程最近更新

我要回帖

更多关于 sdwebimage清除缓存 的文章

 

随机推荐