zoukankan      html  css  js  c++  java
  • 【置顶】最近更新

    2015年01月26日

    1.  

      MPMoviePlayerController 播放视频,不能播放

    解决方法:设置成全局变量就OK了 ,估计是跟内存有关

     

    2.

      iTunes connect 提交 app icon 无法载入文件,

    各种重新保存 还是不行,最终原因:文件名字带有中文字符  擦擦擦

     

     

    3. 

        CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();

      {耗时代码处理}

        CFAbsoluteTime end = CFAbsoluteTimeGetCurrent(); 

       nslog(@"耗时 %f", end - start);

     

    4.  

    IOS ARC 和 非ARC 之间的转换方法

    1. 1,选择项目中的Targets,选中你所要操作的Target,  
    2. 2,选Build Phases,在其中Complie Sources中选择需要ARC的文件双击,  
    3.      并在输入框中输入:-fobjc-arc,如果不要ARC则输入:-fno-objc-arc  

     

    5. 移除uiscrollview 中子视图

    [scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];

     

     6. 

    计算一段文本的尺寸大小,之前使用了NSString类的sizeWithFont:constrainedToSize:lineBreakMode:方法,
    但是该方法已经被iOS7 Deprecated了,而iOS7新出了一个boudingRectWithSize:options:attributes:context方法来代替:


    CGSize size= [@"10" sizeWithFont:self.myFont];
    转成
    CGSize size = [@"10" sizeWithAttributes: @{NSFontAttributeName: [UIFont fontWithName:self.myFont size:10]}];

    CGFloat width1=[(NSString *)ob1 sizeWithFont:[UIFont systemFontOfSize:16] constrainedToSize:CGSizeMake(1000, FONTHEIGHT)].width;
    转成
    CGFloat width1=[(NSString *)ob1 boundingRectWithSize:CGSizeMake(1000, FONTHEIGHT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width;


    boundingRectWithSize: CGSize 对应 constrainedToSize: CGSize
    attributes:@{NSFontAttributeName: [ UIFont ] } 对应 sizeWithFont[ UIFont ]
    options: NSStringDrawingUsesLineFragmentOrigin 默认照填
    context: nil 默认照填

     更多参考:http://blog.csdn.net/iunion/article/details/12185077

     

     

     6、缺省情况下,在 Mac 下是不显示隐藏文件的,Finder 也未提供设置是否显示隐藏文件的选项,不像 Windows 下,

    有一个“文件夹选项“设置界面里可以控制,但这并不表示 Mac 下无法显示隐藏文件,我可以通过“终端”,用命令行设置这个选项,命令如下:

     

    显示:defaults write com.apple.finder AppleShowAllFiles -bool true

    隐藏:defaults write com.apple.finder AppleShowAllFiles -bool false

     

     7.  NSTimer 带参数

     

    scheduledTimerWithTimeInterval 参数设置

    [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(handleTimer:) userInfo:@"参数" repeats:YES];
    

    用的时候只要在下面函数里调用强制转换的userinfo就行,

    -(void)handleTimer:(NSTimer*)timer
    {
    //这里使用(NSString *)[timer userInfo]
    }

     
    7. 自动锁屏控制 

    [UIApplication sharedApplication].idleTimerDisabled=NO;// 自动锁屏
    [UIApplication sharedApplication].idleTimerDisabled=YES;// 不自动锁屏
     




    1、在iOS7之后 带有ScrollView的页面  返回时 整体会下滑 45的高度   原因:iOS自带的优化(也算bug啦);  解决的方法如下 :

    1
    self.automaticallyAdjustsScrollViewInsets = NO;//写在init里面

    2、在iPhone6 和 4s上面 都是全屏的  到了iPhone5/5s就有上下黑边  原因:缺少启动图片;   解决方法如下 :

      使用launch image的  加入1136*960的启动图片 / 使用 launchScreen .Xib 需要做好auto layout (基本不会有这个问题) 

    3、有时 我已经把一个页面加为自己的ChildView  为啥点击上面的按钮 还是会不响应呢? 原因:未加入对应的Controller;  解决方法如下:

    1
    [self addChildViewController:kk];//和add childView一起用
     
  • 相关阅读:
    测开之函数进阶· 第4篇《匿名函数》
    函数进阶· 第3篇《常用内置函数filter()、map()、zip(),怎么用的呢?》
    测开之函数进阶· 第1篇《递归函数》
    测开之数据类型· 第4篇《迭代器、生成器》
    数据类型· 第1篇《元组和列表的性能分析、命名元组》
    Appium上下文和H5测试(二)
    聊聊「测试分工和测试时间」
    Ui Automator 框架和Ui Automator Viewer你会用吗?附送「必备adb命令」拿走不谢 !
    使用Typora+PicGo配置Gitee图床
    持续集成有什么好处?快来看鸭
  • 原文地址:https://www.cnblogs.com/lee4519/p/4251506.html
Copyright © 2011-2022 走看看