比如__bridge吐绵,block的內(nèi)存管理慧妄,而且會針對一個問題拓展問坎穿,考察你是真的了解還是直接背準備好的肄扎。手寫C或者OC代碼是一定有的,而且都比較重視,因為這是考察你的基礎(chǔ)是否牢固犯祠,常見的手寫單例旭等,setter getter,快排都是經(jīng)常問的衡载。
面試說UITableView滑動卡的問題搔耕,讓優(yōu)化,我回答 FB開源的那套渲染排版分離到分線程
又讓設(shè)計一個圖片下載器
Block,多線程痰娱。
問了些單例模式弃榨,為什么蘋果推薦的寫法,不用可以嗎梨睁?問了些循環(huán)引用的問題鲸睛。
總結(jié):
-
__bridge
https://blog.csdn.net/u010130947/article/details/44493931 block的內(nèi)存管理
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 代碼區(qū),棧block 和堆block
ARC 只用全局和堆,系統(tǒng)自動將棧復(fù)制到對上,不引用外部變量的為全局,引用以后為堆
用strong或copy 修飾,因為堆內(nèi)存一直在變有可能被釋放
__block 修改外部變量是修飾,可以將外部變量存入結(jié)構(gòu)體,捕獲的是指針 可以修改
__weak 循環(huán)引用 weakself block里面在strong一下 原因有2 怕釋放self,和__weak對象每使用一次就會加入一次autoreleasepool 中一次 頻繁使用會造成內(nèi)存溢出
3.手寫單例,
#import "SingletonVC.h"
// 創(chuàng)建靜態(tài)對象 防止外部訪問
static SingletonVC * _singletonVC;
@implementation SingletonVC
+ (instancetype)allocWithZone:(struct _NSZone *)zone{
static dispatch_once_t onceToken;
// 一次函數(shù)
dispatch_once(&onceToken, ^{
if (_singletonVC == nil) {
_singletonVC = [super allocWithZone:zone];
}
});
return _singletonVC;
}
+ (instancetype)share{
return [[self alloc] init];
}
@end
#import "SingletonVC.h"
// 創(chuàng)建靜態(tài)對象 防止外部訪問
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
單利的優(yōu)缺點以及詳細講解
http://www.reibang.com/p/4867dc92337e
不要濫用單例
http://wiki.jikexueyuan.com/project/objc/architecture/13-2.html
setter getter
坡贺,
http://www.reibang.com/p/90a7b27c781a
快排
http://www.reibang.com/p/34e920acfe1c
http://www.reibang.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官辈、實現(xiàn)一個字符串“how are you”的逆序輸出(編程語言不限)。如給定字符串為“hello world”,輸出結(jié)果應(yīng)當為“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.設(shè)計一個圖片下載器
http://www.reibang.com/p/4f50db93e7b6
http://www.reibang.com/p/b7a1a6e2ee4c
6.多線程
http://www.reibang.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
//需要詳細閱讀 各種面試總結(jié)
https://blog.csdn.net/u013125233/article/details/51063569
yytext
https://github.com/lzwjava/OpenSourceNotes/blob/master/YYText/YYText.md
http://www.reibang.com/p/e214b3793005
http://www.reibang.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
http://www.reibang.com/p/e2c5b2bab063
https://zhuanlan.zhihu.com/p/25371361?from=groupmessage&isappinstalled=0
星光社性能優(yōu)化
http://www.starming.com/2017/06/20/deeply-ios-performance-optimization/#more