美文网首页
iOS 面试题

iOS 面试题

作者: 奇异之兵 | 来源:发表于2018-01-31 11:04 被阅读0次

    面试过程:

    计算机的工程能力是第一部分,也就是说至少能写代码。

    第二部分就是计算机基础,UI网络数据库多线程。

    第三部分看团队,例如搞直播相关的团队需要音视频的相关的特长。

    第四部分看项目经验,来佐证你之前说的都是真的懂。


    1、怎么检测画面流畅?

    2、CALayer 和 UIView 的父类是什么?他们之间的关系?

    CALayer:NSObject

    UIView:UIResponder

    3、切圆角有几种方法?分别是什么?

    4、UITableView性能优化有哪些?

    5、KVC/KVO

    (1)定义 ;(2)KVO.

    6、自动释放池原理

    7、面试题

    8、SEL和IMP是什么?

    9、GCD四种队列,两种函数和六种组合分别是哪些?

    答:

    四种队列:

    dispatch_queue_t mainQueue = dispatch_get_main_queue();//主队列(串行队列)

    dispatch_queue_t concu = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);//全局并行队列

    dispatch_queue_t queueSerial = dispatch_queue_create("je", DISPATCH_QUEUE_SERIAL);//创建串行队列

    dispatch_queue_t queueConcu = dispatch_queue_create("jr2", DISPATCH_QUEUE_CONCURRENT);//创建并行队列(一般使用系统带的全局并行队列即可)

    六种组合:

     //1>同步执行+串行队(不会开辟子线程)

       dispatch_sync(queueSerial, ^{

           [NSThread sleepForTimeInterval:2];

           NSLog(@"1111%@", [NSThread currentThread]);

       });

       dispatch_sync(queueSerial, ^{

           [NSThread sleepForTimeInterval:2];

           NSLog(@"2222%@", [NSThread currentThread]);

       });        

    //2>同步执行+并行队列(不会开辟子线程)

       dispatch_sync(queueConcu, ^{

           [NSThread sleepForTimeInterval:2];

           NSLog(@"3333%@", [NSThread currentThread]);

       });

       dispatch_sync(queueConcu, ^{

           [NSThread sleepForTimeInterval:2];

           NSLog(@"4444%@", [NSThread currentThread]);

       });            

    //3、异步执行+串行队列(开启一条子线程,且顺序执行)   dispatch_async(queueSerial, ^{

            [NSThread sleepForTimeInterval:2];

           NSLog(@"5555%@", [NSThread currentThread]);

       });    

    dispatch_async(queueSerial, ^{

           [NSThread sleepForTimeInterval:2];

            NSLog(@"6666%@", [NSThread currentThread]);

        });        

    //4、异步执行+并行队列(开启多条子线程,且并发执行)    dispatch_async(queueConcu, ^{

           [NSThread sleepForTimeInterval:2];

            NSLog(@"5555%@", [NSThread currentThread]);

        });

        dispatch_async(queueConcu, ^{

           [NSThread sleepForTimeInterval:2];

           NSLog(@"6666%@", [NSThread currentThread]);

        });        

    //5、异步执行+全局并行队列(开启多条子线程,且并发执行)    dispatch_async(concu, ^{

           [NSThread sleepForTimeInterval:2];

           NSLog(@"5555%@", [NSThread currentThread]);

       });

      dispatch_async(concu, ^{

           [NSThread sleepForTimeInterval:2];

            NSLog(@"6666%@", [NSThread currentThread]);

        });       

     //6、(在主线程中)同步执行+main队列(死锁):NSLog添加到了主队列的最后,NSLog的执行需要等待主队列执行完之后执行,而主队列又在等NSLog执行完(注意与情况3的比较)

      dispatch_sync(mainQueue, ^{

           [NSThread sleepForTimeInterval:2];

            NSLog(@"5555%@", [NSThread currentThread]);

        });

        dispatch_sync(mainQueue, ^{

            [NSThread sleepForTimeInterval:2];

            NSLog(@"6666%@", [NSThread currentThread]);

        });


    相关文章

      网友评论

          本文标题:iOS 面试题

          本文链接:https://www.haomeiwen.com/subject/rjfjkxtx.html