zoukankan      html  css  js  c++  java
  • 面试题(七)

    1 谈谈对Block 的理解?并写出一个使用Block执行UIVew动画?

    答案:Block是可以获取其他函数局部变量的匿名函数,其不但方便开发,并且可以大幅提高应用的执行效率(多核心CPU可直接处理Block指令)

    1. [UIView transitionWithView:self.view  
    2.                   duration:0.2  
    3.                    options:UIViewAnimationOptionTransitionFlipFromLeft  
    4.                 animations:^{ [[blueViewController view] removeFromSuperview]; [[self view] insertSubview:yellowViewController.view atIndex:0]; }  
    5.                 completion:NULL];  

    2 写出上面代码的Block的定义。

    答案:

    typedef void(^animations) (void);

    typedef void(^completion) (BOOL finished);

    3 试着使用+ beginAnimations:context:以及上述Block的定义,写出一个可以完成

    + (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0);操作的函数执行部分

    答案:无

    网络部分

    3 做过的项目是否涉及网络访问功能,使用什么对象完成网络功能?

    答案:ASIHTTPRequest与NSURLConnection

    4 简单介绍下NSURLConnection类及+ sendSynchronousRequest:returningResponse:error:– initWithRequest:delegate:两个方法的区别?

    答案:  NSURLConnection主要用于网络访问,其中+ sendSynchronousRequest:returningResponse:error:是同步访问数据,即当前线程会阻塞,并等待request的返回的response,而– initWithRequest:delegate:使用的是异步加载,当其完成网络访问后,会通过delegate回到主线程,并其委托的对象。

    多线程部分

  • 相关阅读:
    csuoj 漫漫上学路
    sql函数
    sql基本
    查看webdriver API
    Jmeter应用-接口测试
    http协议
    Jmeter .jmx 改为.jtl
    Jmeter遇到打不开的问题
    测试要点
    apt-get安装mysql
  • 原文地址:https://www.cnblogs.com/shidaying/p/4991143.html
Copyright © 2011-2022 走看看