面试准备

比如__bridge,block的内存管理,而且会针对一个问题拓展问,考察你是真的了解还是直接背准备好的。手写C或者OC代码是一定有的,而且都比较重视,因为这是考察你的基础是否牢固,常见的手写单例,setter getter,快排都是经常问的。

面试说UITableView滑动卡的问题,让优化,我回答 FB开源的那套渲染排版分离到分线程
又让设计一个图片下载器

Block,多线程。

问了些单例模式,为什么苹果推荐的写法,不用可以吗?问了些循环引用的问题。

总结:

  1. __bridge
    https://blog.csdn.net/u010130947/article/details/44493931

    https://blog.csdn.net/chy555chy/article/details/51712334

  2. block的内存管理

http://www.cocoachina.com/ios/20161025/17198.html

https://blog.csdn.net/cloudox_/article/details/70157717

https://blog.csdn.net/u012526801/article/details/49281893

https://blog.csdn.net/u012526801/article/details/49281893

block 3种,全局block 代码区,栈block 和堆block
ARC 只用全局和堆,系统自动将栈复制到对上,不引用外部变量的为全局,引用以后为堆
用strong或copy 修饰,因为堆内存一直在变有可能被释放
__block 修改外部变量是修饰,可以将外部变量存入结构体,捕获的是指针 可以修改
__weak 循环引用 weakself   block里面在strong一下  原因有2 怕释放self,和__weak对象每使用一次就会加入一次autoreleasepool 中一次 频繁使用会造成内存溢出

3.手写单例,

#import "SingletonVC.h"
// 创建静态对象 防止外部访问
static SingletonVC * _singletonVC;
@implementation SingletonVC
+ (instancetype)allocWithZone:(struct _NSZone *)zone{
    
    static dispatch_once_t onceToken;
    // 一次函数
    dispatch_once(&onceToken, ^{
        if (_singletonVC == nil) {
            _singletonVC = [super allocWithZone:zone];
        }
    });
    
    return _singletonVC;
}
+ (instancetype)share{
    
    return  [[self alloc] init];
}
@end
#import "SingletonVC.h"
// 创建静态对象 防止外部访问
static SingletonVC * _singletonVC;
@implementation SingletonVC
+ (instancetype)allocWithZone:(struct _NSZone *)zone{
    
    //线程锁
    @synchronized (self) {
        if (_singletonVC == nil) {
            
            _singletonVC = [super allocWithZone:zone];
        }
    }
    
    return _singletonVC;
}
+ (instancetype)share{
    
    return  [[self alloc] init];
}
@end

单利的优缺点以及详细讲解
https://www.jianshu.com/p/4867dc92337e
不要滥用单例
http://wiki.jikexueyuan.com/project/objc/architecture/13-2.html
setter getter
https://www.jianshu.com/p/90a7b27c781a
快排
https://www.jianshu.com/p/34e920acfe1c

https://www.jianshu.com/p/28928b74fe48

字符串逆序

- (NSString *)stringByReversed
{
  NSMutableString *s = [NSMutableString string];
  for (NSUInteger i=self.length; i>0; i--) {
    [s appendString:[self substringWithRange:NSMakeRange(i-1, 1)]];
  }
  return s;
}

https://segmentfault.com/q/1010000000181923
1、实现一个字符串“how are you”的逆序输出(编程语言不限)。如给定字符串为“hello world”,输出结果应当为“world hello”。(字符串逆序输出、二叉树、归并排序)
https://blog.csdn.net/shihuboke/article/details/77145615

c语言逆序(中间切断两边交换,类似快排)

main()  
{  
  int i,j,t,n;  
  char a[10];  
  printf("请输入字符串:");  
  gets(a);  
  n=strlen(a);  
  for(i=0;i<=n/2;i++)  
  {  
    t=a[i];  
    a[i]=a[n-1-i];  
    a[n-1-i]=t;  
      
      }   
      for(j=0;j<n;j++)  
      printf("%c",a[j]);  
      printf("\n");   
 }   

递归逆序字符串
https://blog.csdn.net/u012978932/article/details/46929177

/* 
 * reverse string via the terminating zero 
 */  
void foo1(char* a) {  
    int len = strlen(a);  
    int i;  
      
    for (i = 0; i < len / 2; i++) {  
        a[len] = a[i];  
        a[i] = a[len - i - 1];  
        a[len - i - 1] = a[len];  
    }  
      
    a[len] = 0;  
}  
  
/* 
 * reverse string via a temp variable 
 */  
void foo2(char* a) {  
    char temp;  
    int len = strlen(a);  
    int i;  
      
    for (i = 0; i < len / 2; i++) {  
        temp = a[i];  
        a[i] = a[len - i - 1];  
        a[len - i - 1] = temp;  
    }  
}  
  
/* 
 * reverse string via XORs 
 */  
void foo3(char* a) {  
    int len = strlen(a);  
    int i;  
      
    for (i = 0; i < len / 2; i++) {  
        a[len - i - 1] ^= a[i];  
        a[i] ^= a[len - i - 1];  
        a[len - i - 1] ^= a[i];  
    }  
}  
  

http://rednaxelafx.iteye.com/blog/134002/
4.UITableView滑动卡的问题
https://bestswifter.com/uikitxing-neng-diao-you-shi-zhan-jiang-jie/
https://blog.csdn.net/happyfish2015/article/details/48146287
http://blog.sunnyxx.com/2015/05/17/cell-height-calculation/

https://blog.csdn.net/qq_23616601/article/details/51038263
5.设计一个图片下载器

https://www.jianshu.com/p/4f50db93e7b6
https://www.jianshu.com/p/b7a1a6e2ee4c
6.多线程
https://www.jianshu.com/p/266bec7c4dd2
sdwebimage
https://blog.csdn.net/Maxdong24/article/details/53735205
7,week
http://www.cocoachina.com/ios/20170328/18962.html
百度面试
http://www.cocoachina.com/ios/20171127/21331.html
//需要详细阅读 各种面试总结
https://blog.csdn.net/u013125233/article/details/51063569

yytext
https://github.com/lzwjava/OpenSourceNotes/blob/master/YYText/YYText.md

https://www.jianshu.com/p/e214b3793005

https://www.jianshu.com/p/74fdd28b0a09

微博 采访
http://blog.sina.com.cn/s/blog_68147f680102weti.html
http://mp.weixin.qq.com/s?__biz=MzUxMzcxMzE5Ng==&mid=2247488452&idx=1&sn=0de45a93e355a2700b04b328b042c47a&source=41#wechat_redirect

https://blog.csdn.net/ahut_qyb_6737/article/details/40891683

https://www.cnblogs.com/ioriwellings/p/5011993.html
https://www.cnblogs.com/ioriwellings/p/5011993.html
异步
https://blog.csdn.net/game3108/article/details/53023941
https://www.jianshu.com/p/e2c5b2bab063

https://zhuanlan.zhihu.com/p/25371361?from=groupmessage&isappinstalled=0
星光社性能优化
http://www.starming.com/2017/06/20/deeply-ios-performance-optimization/#more

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 我的暗恋像空气 整日陪伴着你 你从未察寻 我的思念像空气 在每个夜深人静时 想你 看不见 摸不着 只有我一人知...
    禾必阅读 218评论 2 1
  • 昨天朋友给我打电话叙叙旧,聊天中我们无意间提到了她的男友,于是我就顺便问了他俩的情况。 原本以为她会跟我分享很多幸...
    谨卿儿阅读 1,308评论 1 23

友情链接更多精彩内容