我的三星手机i9308是i9308的,我下了s voice,使用的时候显示network error

当前位置: >>
解决:小米路由putty
Network error: Connection refused 问题
作者:& &发布时间: 19:17:34& &浏览次数:5774
Network error: Connection refused
意思为:网络错误:连接无效
这问题基本上为小米路由器ssh没安装成功的原因。
原因如下:
一、ssh_rom.bin 文件不能更改文件名,否则路由器不认。
二、U盘的问题。本人亲自测试,本人一开始用的是32G USB3.0的U 盘且盘里有引导程序,因此试了两遍都提示Network error: Connection refused。
&&&&&& 再后来我找了一个读卡器加一个大卡8G 把文件复制进行进行SSH ,结果成功了。所以原因也有可能是你的U 盘问题。
进行ssh无非是要手机有查看路由器的状态。
vi 命令比较难操作。
(一)、进入vi
在系统提示字符(如$、#)下敲入vi <档案名称>,vi 可以自动帮你载入所要编辑的文件或是开启一个新
文件(如果该文件不存在或缺少文件名)。进入 vi 后萤幕左方会出现波浪符号,凡是列首有该符号就代
表此列目前是空的。
(二)、两种模式
如上所述,vi存在两种模式:指令模式和输入模式。在指令模式下输入的按键将做为指令来处理:如输入
a,vi即认为是在当前位置插入字符。而在输入模式下,vi则把输入的按键当作插入的字符来处理。指令
模式切换到输入模式只需键入相应的输入命令即可(如a,A),而要从输入模式切换到指令模式,则需在
输入模式下键入ESC键,如果不晓得现在是处於什麽模式,可以多按几次 [ESC],系统如发出哔哔声就表
示已处于指令模式下了。
付:有指令模式进入输入模式的指令:
新增 (append)
a :从光标所在位置後面开始新增资料,光标後的资料随新增资料向後移动。
A: 从光标所在列最後面的地方开始新增资料。
插入 (insert)
i: 从光标所在位置前面开始插入资料,光标後的资料随新增资料向後移动。
I :从光标所在列的第一个非空白字元前面开始插入资料。
开始 (open)
o :在光标所在列下新增一列并进入输入模式。
O: 在光标所在列上方新增一列并进入输入模式。
(三)、退出vi
在指令模式下键入:q,:q!,:wq或:x(注意:号),就会退出vi。其中:wq和:x是存盘退出,而:q是直接退出,
如果文件已有新的变化,vi会提示你保存文件而:q命令也会失效,这时你可以用:w命令保存文件后再用:q
退出,或用:wq或:x命令退出,如果你不想保存改变后的文件,你就需要用:q!命令,这个命令将不保存文件
而直接退出vi。
(四)、基本编辑
配合一般键盘上的功能键,像是方向键、[Insert] 、[Delete] 等等,
现在你应该已经可以利用 vi 来编辑文件
了。当然 vi 还提供其他许许多多功能让文字的处理更为方便。
何谓编辑?一般认为是文字的新增、修改以及删除,甚至包括文字区块的搬移、复制等等。先这里介绍 vi
的如何做删除与修改。(注意:在 vi 的原始观念里,输入跟编辑是两码子事。编辑是在指令模式下操作
的,先利用指令移动光标来定位要进行编辑的地方,然後才下指令做编辑。)
删除与修改文件的命令:
x: 删除光标所在字符。
dd :删除光标所在的列。
r :修改光标所在字元,r 後接著要修正的字符。
R: 进入取替换状态,新增文字会覆盖原先文字,直到按 [ESC] 回到指令模式下为止。
s: 删除光标所在字元,并进入输入模式。
S: 删除光标所在的列,并进入输入模式。
其实呢,在PC上根本没有这麽麻烦!输入跟编辑都可以在输入模式下完成。例如要删除字元,直接按
[Delete] 不就得了。而插入状态与取代状态可以直接用 [Insert] 切换,犯不著用什麽指令模式的编
辑指令。不过就如前面所提到的,这些指令几乎是每台终端机都能用,而不是仅仅在 PC 上。
在指令模式下移动光标的基本指令是 h, j, k, l 。想来各位现在也应该能猜到只要直接用 PC 的方向
键就可以了,而且无论在指令模式或输入模式下都可以。多容易不是。
当然 PC 键盘也有不足之处。有个很好用的指令 u 可以恢复被删除的文字,而 U 指令则可以恢复光标所
在列的所有改变。这与某些电脑上的 [Undo] 按键功能相同。
三、附件:vi详细指令表
(一)、基本编辑指令:
新增 (append)
a :从光标所在位置後面开始新增资料,光标後的资料随新增资料向後移动。
A: 从光标所在列最後面的地方开始新增资料。
插入 (insert)
i: 从光标所在位置前面开始插入资料,光标後的资料随新增资料向後移动。
I :从光标所在列的第一个非空白字元前面开始插入资料。
开始 (open)
o :在光标所在列下新增一列并进入输入模式。
O: 在光标所在列上方新增一列并进入输入模式。
x: 删除光标所在字符。
dd :删除光标所在的列。
r :修改光标所在字元,r 後接著要修正的字符。
R: 进入取替换状态,新增文字会覆盖原先文字,直到按 [ESC] 回到指令模式下为止。
s: 删除光标所在字元,并进入输入模式。
S: 删除光标所在的列,并进入输入模式。
(二)、光标移动指令:
由於许多编辑工作是藉由光标来定位,所以 vi 提供许多移动光标的方式,这个我们列
几张简表来说明(这些当然是指令模式下的指令):指令? ? 说明
?????? 功能键
0 移动到光标所在列的最前面
? 移动到光标所在列的最後面 [End]
[CTRL][d] 向下半页
? [PageDown]
[CTRL][u] 向上半页?
[CTRL][b] 向上一页
H 移动到视窗的第一列
M 移动到视窗的中间列
L 移动到视窗的最後列
b 移动到下个字的第一个字母
w 移动到上个字的第一个字母
e 移动到下个字的最後一个字母
^ 移动到光标所在列的第一个非空白字元
指令 说 明
n- 减号移动到上一列的第一个非空白字元前面加上数字可以指定移动到以上 n 列
n+ 加号移动到下一列的第一个非空白字元前面加上数字可以指定移动到以下 n 列
nG 直接用数字 n 加上大写 G 移动到第 n 列
fx 往右移动到 x 字元上
Fx 往左移动到 x 字元上
tx 往右移动到 x 字元前???
往左移动到 x 字元前
配合 f&t 使用,重复一次??
,?? 配合 f&t 使用,反方向重复一次
/string 往右移动到有 string 的地方
?string 往左移动到有 string 的地方
? 配合 /&? 使用,重复一次
? 配合 /&? 使用,反方向重复一次
指令 说明 ?备注
左括号移动到句子的最前面句子是以前面加上数字可以指定往前移动 n 个句子 ! . ? 三种符号来界定
n)? 右括号移动到下个句子的最前面前面加上数字可以指定往後移动 n 个句子 ! . ? 三种符号来界定
?? 左括弧移动到段落的最前面 段落是以段落间的空白列界定
n} 前面加上数字可以指定往前移动 n 个段落右括弧移动到下个段落的最前面前面加上数字可以指定往後移动 n 个段落 段落是以段落间的空白列界定
(三)、更多的编辑指令
这些编辑指令非常有弹性,基本上可以说是由指令与范围所构成。例如 dw 是由删除指令 d 与范围 w 所
组成,代表删除一个字 d(elete) w(ord) 。
指令列表如下:
d 删除(delete)
y 复制(yank)
p 放置(put)
c 修改(change)
范围可以是下列几个:
e 光标所在位置到该字的最後一个字母
w 光标所在位置到下个字的第一个字母
b 光标所在位置到上个字的第一个字母
$ 光标所在位置到该列的最後一个字母
0 光标所在位置到该列的第一个字母
) 光标所在位置到下个句子的第一个字母
( 光标所在位置到该句子的第一个字母
} 光标所在位置到该段落的最後一个字母
{ 光标所在位置到该段落的第一个字母
说实在的,组合这些指令来编辑文件有一点点艺术气息。不管怎麽样,它们提供更多编辑文字的能力。值得
注意的一点是删除与复制都会将指定范围的内容放到暂存区里,然後就可以用指令 p 贴到其它地方去,这
是 vi 用来处理区段拷贝与搬移的办法。
某些 vi 版本,例如 Linux 所用的 elvis 可以大幅简化这一坨指令。如果稍微观察一下这些编辑指令
就会发现问题其实是定范围的方式有点杂,实际上只有四个指令罢了。指令 v 非常好用,只要按下 v 键,
光标所在的位置就会反白,然後就可以移动光标来设定范围,接著再直接下指令进行编辑即可。
对於整列操作, vi 另外提供了更方便的编辑指令。前面曾经提到过删除整列文字的指令 dd 就是其中一个
;cc 可以修改整列文字;而 yy 则是复制整列文字;指令 D 则可以删除光标到该列结束为止所有的文字。
(四)、文件操作指令
文件操作指令多以 : 开头,这跟编辑指令有点区别。
:q 结束编辑(quit)
:q! 不存档而要放弃编辑过的文件。
:w 保存文件(write)其後可加所要存档的档名。
:wq 即存档後离开。
zz 功能与 :wq 相同。
:x 与:wq相同
-----------------------------------------------------------------------------------------------------------------------------------------------------
祝贵亲都能成功!
上一篇:&&&&下一篇:
Copyright &2016 &&
All Right Reserved.
Powered by
版权所有 &今天看啥 热点:
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 Center.
解决方法:
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.,+120.& +/- 100.00m, region
(identifier &+30.,+120.& radius 49.29) &+30.,+120.& 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添加宽高比约束】【查看原文】
相关搜索:
相关阅读:
相关频道:
Android教程最近更新

我要回帖

更多关于 三星手机i9308 的文章

 

随机推荐