iOS闈㈣瘯棰�300+

*闈㈣瘯蹇冨0:鍏跺疄杩欎簺棰樻湰浜洪兘娌℃�庝箞鑳�,浣嗘槸鍦ㄤ笂娴� 涓ゅ懆鍗� 闈簡澶х害10瀹堵� 鏀跺埌宸笉澶�3涓猳ffer,鎬荤粨璧锋潵灏辨槸鎶婂熀纭�鐨勪笢瑗垮紕濂�,澶嶆潅鐨勪笢瑗夸簡瑙e氨ok浜�!

*姝ら搴撴槸2015锛�2106骞村寳涓婂箍娣辨澀鍚勫ぇ灏忓叕鍙搁潰璇曢銆�

*娉�:濡備粖绀句細杩樻槸寰楅潬鏈簨,闈㈣瘯棰�60鍒嗗彧鏄浜嗕竴涓満浼�,鐝嶆儨鏈轰細鐨勫悓鏃舵彁楂樿嚜宸辩‖瀹炲姏鎵嶆槸鐪熺悊!

1.缁欏畾涓�涓瓧绗︿覆,杈撳嚭鏈瓧绗︿覆涓彧鍑虹幇涓�娆″苟涓旀渶闈犲墠鐨勯偅涓瓧绗︾殑浣嶇疆?姣斿鈥渁baccddeeef鈥濆垯鏄痓,杈撳嚭2

绛�: int main()

{

char a[80] = "abaccddeeef\0";

char ch;

int i, m, b[80];

int flag = 0;

ch = getchar();//鑾峰彇涓�涓瓧绗�

m = strlen(a);

for (i = 0; i < m; ++i){

if (a[i] == ch){//鎵惧埌浜嗭紝鐩存帴鍒ゆ柇鏄惁鐩哥瓑

b[flag] = i+1;//璁板綍浣嶇疆

flag += 1;

}

}

if (flag == 0)printf ("no");

else {

printf ("%d\n", flag);

for (i = 0; i < flag; i++){//瀵逛綅缃繘琛岃緭鍑猴紝鐢ㄥ惊鐜�

printf ("%d ", b[i]);

}

printf ("\n");

}

return 0;

}

2.瀹炵幇涓�涓啋娉℃帓搴忔垨鑰呭揩閫熸帓搴�

绛�:鍐掓场鎺掑簭:

intarray[5] = { 28,27,36,45,8};

for (int i = 0; i < 4; i++) {

for(int j = 0; j < 4; j++) {

if (array[j] > array [j + 1]){

int temp = array[j];

array[j] = array[j + 1];

array[j + 1] = temp;

}}}

for(int i = 0; i < 5; i++) {

printf("%d\n",array[i]);}

3.璇风紪鍐欎竴涓嚱鏁扮敤浜庤绠楅樁涔�

绛�: int f(int i)

{intt=1,j;

for(j=1;j<=i;j++)

t=t*j;

return t;

}

4.Cocoa Touch鎻愪緵浜嗗嚑绉岰ore

Animation杩囨浮绫�?

绛�:Cocoa Touch鎻愪緵浜�4绉岰ore

Animation杩囨浮绫诲瀷锛屽垎鍒负锛氫氦鍙夋贰鍖栥�佹帹鎸ゃ�佹樉绀哄拰瑕嗙洊銆�

5.iOS骞冲彴鎬庝箞鍋氭暟鎹殑鎸佷箙鍖�?coredata鍜宻qlite鏈夋棤蹇呯劧鑱旂郴?coredata鏄竴涓叧绯诲瀷鏁版嵁鍚�?

绛�:鏁版嵁鐨勬寔涔呭寲鏈川涓婇兘鏄氨鏄啓鏂囦欢锛屼絾浠庨�昏緫涓婂張鍒嗘垚寰堝绉嶏紝姣斿鍐欏叆娌欑洅锛屾瘮濡傚瓨鍒扮綉缁滀笂锛屾瘮濡傚啓鍏ユ暟鎹簱銆�

core data鏄sqlite鐨勫皝瑁咃紝鍥犱负sqlite鏄痗璇█鐨刟pi锛岀劧鑰屾湁浜轰篃闇�瑕乷bj-c鐨刟pi锛屾墍浠ユ湁浜哻ore data ,鍙﹀锛宑ore data涓嶄粎浠呮槸鎶奵鐨刟pi缈昏瘧鎴恛c鐨刟pi锛岃繕鎻愪緵浜嗕竴浜涚鐞嗙殑鍔熻兘锛屼娇鐢ㄦ洿鍔犳柟渚裤��

飩稟pp鍗囩骇涔嬪悗鏁版嵁搴撳瓧娈垫垨鑰呰〃鏈夋洿鏀逛細瀵艰嚧crash锛孋oreData鐨勭増鏈鐞嗗拰鏁版嵁杩佺Щ鍙樺緱闈炲父鏈夌敤锛屾墜鍔ㄥ啓sql璇彞鎿嶄綔杩樻槸楹荤儲涓�浜涖��

飩稢oreData涓嶅厜鑳芥搷绾礢QLite锛孋oreData鍜宨Cloud鐨勭粨鍚堜篃寰堝ソ锛屽鏋滄湁杩欐柟闈㈤渶姹傜殑璇濅紭鍏堣�冭檻CoreData銆�

飩稢oreData骞朵笉鏄洿鎺ユ搷绾垫暟鎹簱锛屾瘮濡傦細浣跨敤CoreData鏃朵笉鑳借缃暟鎹簱鐨勪富閿紝鐩墠浠嶉渶瑕佹墜鍔ㄦ搷浣溿��

6.Object-c鐨勭被鍙互澶氶噸缁ф壙涔�?鍙互瀹炵幇澶氫釜鎺ュ彛涔�?category鏄粈涔�?閲嶅啓涓�涓被鐨勬柟寮忕敤缁ф壙濂借繕鏄垎绫诲ソ?涓轰粈涔�?

绛�: Object-c鐨勭被涓嶅彲浠ュ閲嶇户鎵匡紱鍙互瀹炵幇澶氫釜鎺ュ彛锛岄�氳繃瀹炵幇澶氫釜鎺ュ彛鍙互瀹屾垚C++鐨勫閲嶇户鎵匡紱Category鏄被鍒紝涓�鑸儏鍐电敤鍒嗙被濂斤紝鐢–ategory鍘婚噸鍐欑被鐨勬柟娉曪紝浠呭鏈珻ategory鏈夋晥锛屼笉浼氬奖鍝嶅埌鍏朵粬绫讳笌鍘熸湁绫荤殑鍏崇郴銆�

7.#import璺�#include鏈変粈涔堝尯鍒�,@class鍛�?#import<>璺�#import鈥濃�濇湁浠�涔堝尯鍒�?

绛�: #import鏄疧bjective-C瀵煎叆澶存枃浠剁殑鍏抽敭瀛楋紝#include鏄疌/C++瀵煎叆澶存枃浠剁殑鍏抽敭瀛�,浣跨敤#import澶存枃浠朵細鑷姩鍙鍏ヤ竴娆★紝涓嶄細閲嶅瀵煎叆锛岀浉褰撲簬#include鍜�#pragma once锛汙class鍛婅瘔缂栬瘧鍣ㄦ煇涓被鐨勫0鏄庯紝褰撴墽琛屾椂锛屾墠鍘绘煡鐪嬬被鐨勫疄鐜版枃浠讹紝鍙互瑙e喅澶存枃浠剁殑鐩镐簰鍖呭惈锛�#import<>鐢ㄦ潵鍖呭惈绯荤粺鐨勫ご鏂囦欢锛�#import鈥濃�濈敤鏉ュ寘鍚敤鎴峰ご鏂囦欢銆�

8.灞炴�eadwrite,readonly,assin,retain,copy,nonatomic鍚勬槸浠�涔堜綔鐢�,鍦ㄥ摢绉嶆儏鍐典笅鐢�?

绛�: readwrite鏄彲璇诲彲鍐欑壒鎬э紱闇�瑕佺敓鎴恎etter鏂规硶鍜宻etter鏂规硶鏃�

readonly鏄彧璇荤壒鎬у彧浼氱敓鎴恎etter鏂规硶涓嶄細鐢熸垚setter鏂规硶;涓嶅笇鏈涘睘鎬у湪绫诲鏀瑰彉

assign鏄祴鍊肩壒鎬э紝setter鏂规硶灏嗕紶鍏ュ弬鏁拌祴鍊肩粰瀹炰緥鍙橀噺锛涗粎璁剧疆鍙橀噺鏃讹紱

retain琛ㄧず鎸佹湁鐗规�э紝setter鏂规硶灏嗕紶鍏ュ弬鏁板厛淇濈暀锛屽啀璧嬪�硷紝浼犲叆鍙傛暟鐨剅etaincount浼�+1;

copy琛ㄧず鎷疯礉鐗规�э紝setter鏂规硶灏嗕紶鍏ュ璞″鍒朵竴浠斤紱闇�瑕佸畬鍏ㄤ竴浠芥柊鐨勫彉閲忔椂銆�

nonatomic闈炲師瀛愭搷浣滐紝鍐冲畾缂栬瘧鍣ㄧ敓鎴愮殑setter

getter鏄惁鏄師瀛愭搷浣滐紝atomic琛ㄧず澶氱嚎绋嬪畨鍏紝涓�鑸娇鐢╪onatomic

9.鍐欎竴涓猻etter鏂规硶鐢ㄤ簬瀹屾垚@property(nonatomic,

retain)NSString *name;鍐欎竴涓猻etter鏂规硶鐢ㄤ簬瀹屾垚@property(nonatomic, copy)NSString *name;

绛�: -(void)setName:(NSString *) str

{

[str retain];

[name release];

name = str;

}

- (void)setName:(NSString *)str

{

id t = [str copy];

[name release];

name = t;聽 }

10.瀵逛簬璇彞NSString *obj =

[[NSData alloc] init]; obj鍦ㄧ紪璇戞椂鍜岃繍琛屾椂鍒嗗埆鏄粈涔堢被鍨嬬殑瀵硅薄?

绛�:缂栬瘧鏃舵槸NSString鐨勭被鍨嬶紱杩愯鏃舵槸NSData绫诲瀷鐨勫璞�

11.褰撳墠宸茬粡缂栫▼瀹炵幇鍑芥暟:int

rand100().璇ュ嚱鏁板彲杩斿洖0~99鐨勯殢鏈烘暣鏁�,涓斿彲浠ヤ繚璇佺瓑姒傜巼.璇峰埄鐢ㄨ鍑芥暟瀹炵幇int rand10000(),瑕佹眰绛夋鐜囪繑鍥�0~9999鐨勯殢鏈烘暟.(涓嶅彲浣跨敤鍏朵粬鐨勭郴缁熷嚱鏁�)

12.姹ゅ鐜板湪瑕佸湪瀹堕噷涓捐瀹翠細,浠栬櫧鐒舵湁寰堝绛峰瓙,浣嗚繖浜涚瀛愮殑闀垮害骞朵笉瀹屽叏鐩稿悓,鍏堝凡鐭ユ瘡鏍圭瀛愮殑闀垮害,瑕佹眰姣忎綅瀹汉閮借兘鎷垮埌涓ゆ牴闀垮害鐩稿悓鐨勭瀛�

,姹傛渶澶氬彲閭�璇风殑瀹汉鏁�.

缂栫▼瀹炵幇:int getMax(int arrLength[N])

13.鐜版湁涓�涓暣鏁板簭鍒�,浣犲彲浠ヤ氦鎹㈠叾涓殑浠绘剰涓や釜鏁颁互寰楀埌涓�涓柊搴忓垪.姹傚叡鑳藉緱鍒板灏戠鍙兘缁撴灉.(娉ㄦ剰:3,3,3,3鏃犺鎬庝箞浜ゆ崲,鍙兘寰楀埌涓�涓簭鍒�)

缂栫▼瀹炵幇:int getTotal(int arrOrigin[N])

14.鐜版湁涓�涓狹琛孨鍒楃殑鏁扮粍,瑕佹眰瀹夎鍙嶅悜鏂滃瑙掔嚎(鍙充笂->宸︿笅)鐨勬柟寮�,鎵撳嵃璇ユ暟缁�.缂栫▼瀹炵幇:intprintMatrix[int arrMatrix[M][N]]

涓嬮潰鏍蜂緥鐨勬墦鍗伴『搴忎负:

0->1->4->2->5->8->3->6->9->7->10->11

123

4567

8910 11

15.鍦║IKit涓�,frame涓巄ounds鐨勫叧绯绘槸( C )

A. frame鏄痓ounds鐨勫埆鍚�

B. frame鏄痓ounds鐨勭户鎵跨被

C. frame鐨勫弬鑰冪郴鏄埗瑙勫浘鍧愭爣, bounds鐨勫弬鑰冪郴鏄嚜韬殑鍧愭爣

D.frame鐨勫弬鑰冪郴鏄嚜韬潗鏍�,bounds鐨勫弬鑰冪郴鏄埗瑙勫浘鐨勫潗鏍�

16.涓�涓被鐨刣elegate(浠g悊)鐨勪綔鐢ㄤ笉姝g‘鐨勬槸( D )

A.delegate涓殑鍑芥暟鍦ㄥ叾浠栫被涓疄鐜�

B.涓昏鐢ㄤ簬涓嶅悓绫诲瀷鐨勫璞′箣闂翠竴瀵逛竴浼犻�掓秷鎭�

C.娌℃湁鎸囨淳鍒欎笉浼氳Е鍙�

D.鍙互涓�涓璞$殑delegate鎸囨淳缁欏涓叾浠栫被鍨嬬殑瀵硅薄

17.涓嬮潰鍏充簬Objective-C鍐呭瓨绠$悊鐨勬弿杩伴敊璇殑鏄�(A )

A.褰撲娇鐢ˋRC鏉ョ鐞嗗唴瀛樻椂,瀵硅薄鐨剅etain,dealloc鏂规硶涓嶄細琚皟鐢�

B.autoreleasepool鍦╠rain鐨勬椂鍊欎細閲婃斁鍦ㄥ叾涓垎閰嶇殑瀵硅薄

C.褰撲娇鐢ˋRC鏉ョ鐞嗗唴瀛樻椂,鍦ㄧ嚎绋嬩腑澶ч噺鍒嗛厤瀵硅薄鑰屼笉鐢╝utoreleasepool鍒欏彲鑳戒細閫犳垚鍐呭瓨娉勯湶

D.鍦ㄤ娇鐢ˋRC鐨勯」鐩腑涓嶈兘浣跨敤NSZone

18.涓嬮潰block瀹氫箟姝g‘鐨勬槸( A )

A.tyoedef void(^SuccessBlock)(BOOLsuccess);

B. tyoedef void(^SuccessBlock)(NSStringvalue,BOOL success);

C. tyoedef void^(SuccessBlock)(NSStringvalue,BOOL success);

D. tyoedef void^(SuccessBlock)(NSString*value);

19.UIButton浠庡瓙绫诲埌鐖剁被涓�娆$户鎵胯嚜:( D )

A. UIView-> UIViewController->UIController

B. UIResponder-> UIControl-> UIView

C. UIControl-> UIResponder->UIViewController

D. UIControl-> UIView-> UIResponder

20.涓嬪垪鍏充簬iOS寮�鍙戜腑绫绘柟娉曠殑浣跨敤鎻忚堪,閿欒鐨勬槸:( C )

A.绫绘柟娉曞彲浠ヨ皟鐢ㄧ被鏂规硶

B.绫绘柟娉曚笉鍙互璋冪敤瀹炰緥鏂规硶,浣嗘槸绫绘柟娉曞彲浠ラ�氳繃鍒涘缓瀵硅薄鏉ヨ闂疄渚嬫柟娉�

C.绫绘柟娉曚笉鍙互浣跨敤瀹炰緥鍙橀噺,鍖呮嫭self(鍙互浣跨敤self)

D.绫绘柟娉曚綔涓烘秷鎭�,鍙互琚彂閫佸埌绫绘垨鑰呭璞¢噷闈㈠幓

31.浠�涔堟儏鍐典笅浣跨敤鍏抽敭瀛梬eak鍜宎ssign鏈変綍涓嶅悓?

绛�:assign鎸囬拡璧嬪��,涓嶅寮曠敤璁℃暟鎿嶄綔,浣跨敤涔嬪悗濡傛灉娌℃湁缃负nil,鍙兘灏变細浜х敓閲庢寚閽�;鑰寃eak涓�鏃︿笉杩涜浣跨敤鍚�,姘歌繙涓嶄細浣跨敤浜�,灏变笉浼氫骇鐢熼噹鎸囬拡!

32.Object-C鐨勭被鍙互澶氶噸缁ф壙涔�?鍙互瀹炵幇澶氫釜鎺ュ彛涔�?Category鏄粈涔�?閲嶅啓涓�涓被鏂规硶鐨勬柟娉曠敤缁ф壙濂借繕鏄垎绫诲ソ?涓轰粈涔�?

绛�: Object-c鐨勭被涓嶅彲浠ュ閲嶇户鎵匡紱鍙互瀹炵幇澶氫釜鎺ュ彛锛岄�氳繃瀹炵幇澶氫釜鎺ュ彛鍙互瀹屾垚C++鐨勫閲嶇户鎵匡紱Category鏄被鍒紝涓�鑸儏鍐电敤鍒嗙被濂斤紝鐢–ategory鍘婚噸鍐欑被鐨勬柟娉曪紝浠呭鏈珻ategory鏈夋晥锛屼笉浼氬奖鍝嶅埌鍏朵粬绫讳笌鍘熸湁绫荤殑鍏崇郴銆�

32.濡備綍鐢╥OS璁惧杩涜鎬ц兘娴嬭瘯?

绛�: Profile-> Instruments ->Time Profiler

33.鎴戜滑璇寸殑oc鏄姩鎬佽繍琛屾椂璇煶鏄粈涔堟剰鎬�?

绛旀锛氬鎬併�備富瑕佹槸灏嗘暟鎹被鍨嬬殑纭畾鐢辩紪璇戞椂锛屾帹杩熷埌浜嗚繍琛屾椂銆傝繖涓棶棰樺叾瀹炴祬娑夊強鍒颁袱涓蹇碉紝杩愯鏃跺拰澶氭�併�傜畝鍗曟潵璇达紝杩愯鏃舵満鍒朵娇鎴戜滑鐩村埌杩愯鏃舵墠鍘诲喅瀹氫竴涓璞$殑绫诲埆锛屼互鍙婅皟鐢ㄨ绫诲埆瀵硅薄鎸囧畾鏂规硶銆傚鎬侊細涓嶅悓瀵硅薄浠ヨ嚜宸辩殑鏂瑰紡鍝嶅簲鐩稿悓鐨勬秷鎭殑鑳藉姏鍙仛澶氭�併�傛剰鎬濆氨鏄亣璁剧敓鐗╃被锛坙ife锛夐兘鐢ㄦ湁涓�涓浉鍚岀殑鏂规硶-eat;閭d汉绫诲睘浜庣敓鐗╋紝鐚篃灞炰簬鐢熺墿锛岄兘缁ф壙浜唋ife鍚庯紝瀹炵幇鍚勮嚜鐨別at锛屼絾鏄皟鐢ㄦ槸鎴戜滑鍙渶璋冪敤鍚勮嚜鐨別at鏂规硶銆備篃灏辨槸涓嶅悓鐨勫璞′互鑷繁鐨勬柟寮忓搷搴斾簡鐩稿悓鐨勬秷鎭紙鍝嶅簲浜唀at杩欎釜閫夋嫨鍣級銆傚洜姝や篃鍙互璇达紝杩愯鏃舵満鍒舵槸澶氭�佺殑鍩虹銆�

34.浣犵殑椤圭洰浠�涔堟椂鍊欓�夋嫨浣跨敤GCD,浠�涔堟椂鍊欓�夋嫨NSOperation?

绛�:椤圭洰涓娇鐢∟SOperation鐨勪紭鐐规槸NSOperation鏄绾跨▼鐨勯珮搴︽娊璞★紝鍦ㄩ」鐩腑浣跨敤瀹冿紝浼氫娇椤圭洰鐨勭▼搴忕粨鏋勬洿濂斤紝瀛愮被鍖朜SOperation鐨勮璁℃�濊矾锛屾槸鍏锋湁闈㈠悜瀵硅薄鐨勪紭鐐�(澶嶇敤銆佸皝瑁�)锛屼娇寰楀疄鐜版槸澶氱嚎绋嬫敮鎸侊紝鑰屾帴鍙g畝鍗曪紝寤鸿鍦ㄥ鏉傞」鐩腑浣跨敤銆傞」鐩腑浣跨敤GCD鐨勪紭鐐规槸GCD鏈韩闈炲父绠�鍗曘�佹槗鐢紝瀵逛簬涓嶅鏉傜殑澶氱嚎绋嬫搷浣滐紝浼氳妭鐪佷唬鐮侀噺锛岃�孊lock鍙傛暟鐨勪娇鐢紝浼氭槸浠g爜鏇翠负鏄撹锛屽缓璁湪绠�鍗曢」鐩腑浣跨敤銆�

35.璇绘枃浠舵槸杈撳叆娴佽繕鏄緭鍑烘祦?

涓滆タ璇诲叆鍐呭瓨灏辨槸杈撳叆娴佷笢瑗夸粠鍐呭瓨鍐欏埌璁板綍瀛樺偍杈撳嚭娴佽�屾垜浠湰韬氨浠ヨ褰曞瓨鍌ㄤ负鍘熺偣鎵�鏈変細鏈変笉瑙g殑鎰熻锝瀓ava io娴佹寜鐓ava io娴佺殑鏂瑰悜鍙互鍒嗕负杈撳叆娴佸拰杈撳嚭娴佽緭鍏ユ祦鏄皢璧勬簮鏁版嵁璇诲叆鍒扮紦鍐睟uffer涓紝杈撳嚭娴佹槸灏嗙紦鍐睟uffer涓殑鏁版嵁鎸夌収鎸囧畾鏍煎紡鍐欏嚭鍒颁竴涓寚瀹氱殑浣嶇疆锛屾墍浠ヨ繖涓や釜娴佷竴鑸悓鏃朵娇鐢紝鎵嶆湁鎰忎箟銆備緥濡備綘瑕佸仛鏂囦欢鐨勪笂浼狅紝浣犺鍏堢敤杈撳叆娴佸皢寰呬笂浼犳枃浠惰鍏ョ紦鍐诧紝鐒跺悗鐢ㄨ緭鍑烘祦灏嗘枃浠跺啓鍑哄埌缃戠粶鏈嶅姟鍣ㄧ殑涓�涓綅缃紝鍒欎笂浼犳垚鍔燂紱鑻ユ槸鏂囦欢涓嬭浇锛屽垯鍏堣幏寰楄緭鍏ユ祦锛屾潵璇诲彇缃戠粶鏈嶅姟鍣ㄤ腑鐨勪竴涓枃浠讹紝鐒跺悗鐢ㄨ緭鍑烘祦鍐欏埌鏈湴鐨勪竴涓枃浠朵腑锛涜繕鏈変緥濡傛枃浠剁殑鎷疯礉锛屼篃鏄厛鐢ㄨ緭鍏ユ祦璇诲啀鐢ㄨ緭鍑烘祦鍐欏嚭鍘荤殑寰堝ソ鐨勪緥瀛愶紝浣犲彲浠ュ厛鍋氫竴涓皬渚嬪瓙璇曡瘯锛屽浣犵悊瑙ava io鏈夊府鍔�

36.绠�杩癈ALayer鍜孶IView鐨勫叧绯�

绛�:UIView鍜孋ALayer鏄浉浜掍緷璧栫殑鍏崇郴銆俇IView渚濊禆涓巆alayer鎻愪緵鐨勫唴瀹癸紝CALayer渚濊禆uivew鎻愪緵鐨勫鍣ㄦ潵鏄剧ず缁樺埗鐨勫唴瀹广�傚綊鏍瑰埌搴旵ALayer鏄繖涓�鍒囩殑鍩虹锛屽鏋滄病鏈塁ALayer锛孶IView鑷韩涔熶笉浼氬瓨鍦紝UIView鏄竴涓壒娈婄殑CALayer瀹炵幇锛屾坊鍔犱簡鍝嶅簲浜嬩欢鐨勮兘鍔涖��

缁撹锛�

UIView鏉ヨ嚜CALayer锛岄珮浜嶤ALayer锛屾槸CALayer楂樺眰瀹炵幇涓庡皝瑁呫�俇IView鐨勬墍鏈夌壒鎬ф潵婧愪簬CALayer鏀寔銆�

37.澹版槑涓�涓潤鎬佹柟娉曞拰涓�涓疄渚嬫柟娉�

绛�:鍏堣瀹炰緥鏂规硶锛屽綋浣犵粰涓�涓被鍐欎竴涓柟娉曪紝濡傛灉璇ユ柟娉曢渶瑕佽闂煇涓疄渚嬬殑鎴愬憳鍙橀噺鏃讹紝閭d箞灏卞皢璇ユ柟娉曞畾涔夋垚瀹炰緥鏂规硶銆備竴绫荤殑瀹炰緥閫氬父鏈変竴浜涙垚鍛樺彉閲忥紝鍏朵腑鍚湁璇ュ疄渚嬬殑鐘舵�佷俊鎭�傝�岃鏂规硶闇�瑕佹敼鍙樿繖浜涚姸鎬併�傞偅涔堣鏂规硶闇�瑕佸0鏄庢垚瀹炰緥鏂规硶銆�

闈欐�佹柟娉曟濂界浉鍙嶏紝瀹冧笉闇�瑕佽闂煇涓疄渚嬬殑鎴愬憳鍙橀噺锛屽畠涓嶉渶瑕佸幓鏀瑰彉鏌愪釜瀹炰緥鐨勭姸鎬併�傛垜浠妸璇ユ柟娉曞畾涔夋垚闈欐�佹柟娉曘��

38.甯歌鐨凮bject-C鐨勬暟鎹被鍨嬫湁鍝簺?鍜孋d鍩烘湰鏁版嵁绫诲瀷鏈変粈涔堝尯鍒�?

绛�: object-c鐨勬暟鎹被鍨嬫湁nsstring,nsnumber,nsarray,nsmutablearray,nsdata绛夌瓑,杩欎簺閮芥槸class,鍒涘缓鍚庝究鏄璞�,鑰宑璇█鐨勫熀鏈暟鎹被鍨媔nt,鍙槸涓�瀹氬瓧鑺傜殑鍐呭瓨绌洪棿,鐢ㄤ簬瀛樻斁鏁板��;鑰宱bject-c鐨刵snumber鍖呭惈鏈夌埗nsobject鐨勬柟娉曞拰nsnumber鑷繁鐨勬柟娉�,鍙互瀹屾垚澶嶆潅鐨勬搷浣溿��

39.UIView鐨勫姩鐢绘晥鏋滄湁鍝簺

濡俇IViewAnimationOptionCurveEaseInOut

UIViewAnimationOptionCurveEaseIn

UIViewAnimationOptionCurveEaseOut

UIViewAnimationOptionTransitionFlipFromLeft

UIViewAnimationOptionTransitionFlipFromRight

UIViewAnimationOptionTransitionCurlUp

UIViewAnimationOptionTransitionCurlDown

40.浣犱簡瑙vn,cvs绛夌増鏈帶鍒跺伐鍏蜂箞?

绛�:浜嗚В.

41.闈欐�侀摼鎺ュ簱(浜嗚В涓�涓�)

绛旓細闈欐�佸簱鏄▼搴忎唬鐮佺殑闆嗗悎锛屾槸鍏变韩浠g爜鐨勪竴绉嶆柟寮�

闈欐�佸簱鏄棴婧愮殑瀛樺湪褰㈠紡.a鍜�.framework

杩炴帴鏃讹紝闈欐�佸簱浼氳瀹屽叏鐨勫鍒跺埌鍙墽琛屾枃浠朵腑锛岃澶氭浣跨敤灏变細鏈夊啑浣欐嫹璐濓紝鐩稿綋浜巎ava閲岀殑jar鍖咃紝鎶婁竴浜涚被缂栬瘧鍒颁竴涓寘涓紝鍦ㄤ笉鍚岀殑宸ョ▼涓鏋滃鍏ユ鏂囦欢灏卞彲浠ヤ娇鐢ㄩ噷闈㈢殑绫伙紝

42.浠�涔堟槸娌欑妯″瀷?鍝簺鎿嶄綔鏄睘浜庣鏈塧pi鑼冪暣?

绛�:1銆佸簲鐢ㄧ▼搴忓彲浠ュ湪鑷繁鐨勬矙鐩掗噷杩愪綔锛屼絾鏄笉鑳借闂换浣曞叾浠栧簲鐢ㄧ▼搴忕殑娌欑洅銆�

2銆佸簲鐢ㄧ▼搴忛棿涓嶈兘鍏变韩鏁版嵁锛屾矙鐩掗噷鐨勬枃浠朵笉鑳借澶嶅埗鍒板叾浠栧簲鐢ㄧ▼搴忔枃浠跺す涓�,涔熶笉鑳芥妸鍏朵粬搴旂敤绋嬪簭鏂囦欢澶逛腑鐨勬枃浠跺鍒跺埌娌欑洅閲屻��

3銆佽嫻鏋滅姝换浣曡銆佸啓娌欑洅浠ュ鐨勬枃浠讹紝绂佹搴旂敤绋嬪簭灏嗗唴瀹瑰啓鍒版矙鐩掍互澶栫殑鏂囦欢澶逛腑銆�

4銆佹矙鐩掓牴鐩綍閲屾湁涓変釜鏂囦欢澶癸細Documents锛屼竴鑸簲璇ユ妸搴旂敤绋嬪簭鐨勬暟鎹枃浠跺瓨鍒拌繖涓枃浠跺す閲岋紝鐢ㄤ簬瀛樺偍鐢ㄦ埛鏁版嵁鎴栧叾浠栧簲璇ュ畾鏈熷浠界殑淇℃伅銆侺ibrary锛屼笅鏈変袱涓枃浠跺す锛孋aches瀛樺偍搴旂敤绋嬪簭鍐嶆鍚姩鎵�闇�鐨勪俊鎭紝Preferences鍖呭惈搴旂敤绋嬪簭鍋忓ソ璁剧疆鏂囦欢锛屼笉杩囦笉瑕佸湪杩欓噷淇敼鍋忓ソ璁剧疆銆倀emp锛屽瓨鏀句复鏃舵枃浠讹紝鍗冲簲鐢ㄧ▼搴忓啀娆″惎鍔ㄤ笉闇�瑕佺殑鏂囦欢銆�

娌欑洅鏍圭洰褰曢噷鏈変笁涓枃浠跺す鍒嗗埆鏄細documents锛宼mp锛孡ibrary銆�

1銆丏ocuments鐩綍锛氭偍搴旇灏嗘墍鏈塪e搴旂敤绋嬪簭鏁版嵁鏂囦欢鍐欏叆鍒拌繖涓洰褰曚笅銆傝繖涓洰褰曠敤浜庡瓨鍌ㄧ敤鎴锋暟鎹垨鍏跺畠搴旇瀹氭湡澶囦唤鐨勪俊鎭��

2銆丄ppName.app鐩綍锛氳繖鏄簲鐢ㄧ▼搴忕殑绋嬪簭鍖呯洰褰曪紝鍖呭惈搴旂敤绋嬪簭鐨勬湰韬�傜敱浜庡簲鐢ㄧ▼搴忓繀椤荤粡杩囩鍚嶏紝鎵�浠ユ偍鍦ㄨ繍琛屾椂涓嶈兘瀵硅繖涓洰褰曚腑鐨勫唴瀹硅繘琛屼慨鏀癸紝鍚﹀垯鍙兘浼氫娇搴旂敤绋嬪簭鏃犳硶鍚姩銆�

3銆丩ibrary鐩綍锛氳繖涓洰褰曚笅鏈変袱涓瓙鐩綍锛欳aches鍜孭references

Preferences鐩綍锛氬寘鍚簲鐢ㄧ▼搴忕殑鍋忓ソ璁剧疆鏂囦欢銆傛偍涓嶅簲璇ョ洿鎺ュ垱寤哄亸濂借缃枃浠讹紝鑰屾槸搴旇浣跨敤NSUserDefaults绫绘潵鍙栧緱鍜岃缃簲鐢ㄧ▼搴忕殑鍋忓ソ.

Caches鐩綍锛氱敤浜庡瓨鏀惧簲鐢ㄧ▼搴忎笓鐢ㄧ殑鏀寔鏂囦欢锛屼繚瀛樺簲鐢ㄧ▼搴忓啀娆″惎鍔ㄨ繃绋嬩腑闇�瑕佺殑淇℃伅銆�

4銆乼mp鐩綍锛氳繖涓洰褰曠敤浜庡瓨鏀句复鏃舵枃浠讹紝淇濆瓨搴旂敤绋嬪簭鍐嶆鍚姩杩囩▼涓笉闇�瑕佺殑淇℃伅銆�

iOS娌欑洅(sandbox)涓殑鍑犱釜鐩綍鑾峰彇鏂瑰紡锛�

//鑾峰彇娌欑洅涓荤洰褰曡矾寰�

NSString *homeDir = NSHomeDirectory();

//鑾峰彇Documents鐩綍璺緞

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *docDir = [paths objectAtIndex:0];

//鑾峰彇Caches鐩綍璺緞

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);

NSString *cachesDir = [paths objectAtIndex:0];

//鑾峰彇tmp鐩綍璺緞

NSString *tmpDir =聽 NSTemporaryDirectory();

//鑾峰彇褰撳墠绋嬪簭鍖呬腑涓�涓浘鐗囪祫婧愶紙apple.png锛夎矾寰�

NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"apple" ofType:@"png"];

UIImage *appleImage = [[UIImage alloc] initWithContentsOfFile:imagePath];

渚嬪瓙锛�

NSFileManager* fm=[NSFileManagerdefaultManager];

if(![fm fileExistsAtPath:[selfdataFilePath]]){

//涓嬮潰鏄璇ユ枃浠惰繘琛屽埗瀹氳矾寰勭殑淇濆瓨

[fm createDirectoryAtPath:[selfdataFilePath] withIntermediateDirectories:YES attributes:nil error:nil];

//鍙栧緱涓�涓洰褰曚笅寰楁墍鏈夋枃浠跺悕

NSArray *files = [fm subpathsAtPath: [selfdataFilePath] ];

//璇诲彇鏌愪釜鏂囦欢

NSData *data = [fm contentsAtPath:[selfdataFilePath]];

//鎴栬��

NSData *data = [NSDatadataWithContentOfPath:[self dataFilePath]];

}

43.鍗忚鏄粈涔�?鏈変粈涔堜綔鐢�?

鍗忚锛氬0鏄庝竴绯诲垪鐨勬柟娉曪紝鍙敱浠讳綍绫诲疄鏂斤紝鍗充娇閬靛畧璇ュ崗璁殑绫绘病鏈夊叡鍚岀殑瓒呯被銆傚崗璁柟娉曞畾涔変簡鐙珛浜庝换浣曠壒瀹氱被鐨勮涓恒�傜畝鍗曠殑璇达紝鍗忚灏辨槸瀹氫箟浜嗕竴涓帴鍙o紝鍏朵粬绫昏礋璐f潵瀹炵幇杩欎簺鎺ュ彛銆傚鏋滀綘鐨勭被瀹炵幇浜嗕竴涓崗璁殑鏂规硶鏃讹紝鍒欒璇ョ被閬靛惊姝ゅ崗璁��

鍗忚鐨勪綔鐢細

1.瀹氫箟涓�濂楀叕鐢ㄧ殑鎺ュ彛锛圥ublic锛�

@required锛氬繀椤诲疄鐜扮殑鏂规硶

@optional锛氬彲閫夊疄鐜扮殑鏂规硶锛堝彲浠ュ叏閮ㄩ兘涓嶅疄鐜帮級

2.濮旀墭浠g悊锛圖elegate锛変紶鍊硷細

瀹冩湰韬槸涓�涓璁℃ā寮忥紝瀹冪殑鎰忔�濇槸濮旀墭鍒汉鍘诲仛鏌愪簨銆�

姣斿锛氫袱涓被涔嬮棿鐨勪紶鍊硷紝绫籄璋冪敤绫籅鐨勬柟娉曪紝绫籅鍦ㄦ墽琛岃繃绋嬩腑閬囧埌闂閫氱煡绫籄锛岃繖鏃跺�欐垜浠渶瑕佺敤鍒颁唬鐞嗭紙Delegate锛夈��

鍙堟瘮濡傦細鎺у埗鍣紙Controller锛変笌鎺у埗鍣紙Controller锛変箣闂寸殑浼犲�硷紝浠嶤1璺宠浆鍒癈2锛屽啀浠嶤2杩斿洖鍒癈1鏃堕渶瑕侀�氱煡C1鏇存柊UI鎴栬�呮槸鍋氬叾瀹冪殑浜嬫儏锛岃繖鏃跺�欐垜浠氨鐢ㄥ埌浜嗕唬鐞嗭紙Delegate锛変紶鍊笺��

44.浣犲湪寮�鍙戝ぇ鍨嬮」鐩椂,濡備綍杩涜鍐呭瓨娉勯湶妫�娴嬬殑?

鍙互閫氳繃xcode鐨勮嚜甯﹀伐鍏穜un---start with performance tool閲屾湁instruments涓嬫湁涓猯eaks宸ュ叿锛�

鍚姩姝ゅ伐鍏峰悗锛岃繍琛岄」鐩紝宸ュ叿閲屽彲浠ユ樉绀哄唴瀛樻硠闇茬殑鎯呭喌锛屽弻鍑诲彲鎵惧埌婧愮爜浣嶇疆锛屽彲浠ュ府鍔╄繘琛屽唴瀛樻硠闇茬殑澶勭悊銆�

45.浣犲疄鐜拌繃涓�涓鏋舵垨鑰呭簱浠ヤ緵鍒汉浣跨敤涔�?濡傛灉鏈�,璇疯皥涓�璋堟瀯寤烘鏋舵垨鑰呭簱鏄殑缁忛獙;濡傛灉娌℃湁,璇疯鎯冲拰璁捐妗嗘灦鐨刾ublic鐨凙PI,骞舵寚鍑哄ぇ姒傞渶瑕佸浣曞仛,闇�瑕佹敞鎰忎竴浜涗粈涔堟柟闈�,鏉ユ柟渚垮埆浜哄鏄撳湴浣跨敤浣犵殑妗嗘灦.

46.app浠庡垱寤哄簲鐢ㄥ埌涓婃灦杩囩▼(appstore)

鍦ㄤ綘寮�濮嬪皢绋嬪簭鎻愪氦鍒癆pp Store涔嬪墠锛屼綘闇�瑕佹湁涓�涓狝pp ID锛屼竴涓湁鏁堢殑鍙戝竷璇佷功锛屼互鍙婁竴涓湁鏁堢殑Provisioning profile銆�

鍦╥tunesconnect缃戠珯涓�,鍒涘缓app搴旂敤锛岃缃搴斾俊鎭紝涓婁紶app鎵撳寘鏂囦欢锛屾彁浜ょ瓑寰呭鏍�

47.鐢ㄤ綘鐔熸倝鐨勮闊�,缂栫▼瀹炵幇Fibonacci鏁板垪:int F(intn);

Fibonacci鏁板垪閫掓帹寮廎(n) = F(n-1) +F(n-2)

F(1) = 1

F(2) = 2

F(3) = 3

F(4) = 5

F(5) = 8

int F(int n){

if(n == 1){

return1;

}

return f(n-1)+f(n-2);

}

48.缁欏畾涓や釜鎺掑ソ搴忕殑鏁扮粍A,B,璇峰啓涓�涓嚱鏁�,浠庝腑鎵惧嚭浠栦滑鐨勫叕鍏卞厓绱�:findCommon(A,

B)骞跺垪涓惧叾浠栧彲鑳界殑鏌ユ壘鏂规硶,瓒婂瓒婂ソ

渚嬪:

Array A = [1, 3, 5, 6, 9]

Array B = [2, 3, 6, 8, 10]

杩斿洖缁撴灉= [3, 6]

void FindCommon(int* a, int* b, int n)

{

int i = 0;

int j = 0 ;

while(i < n && j < n){

if (a[i] < b[j])

++i ;

else if(a[i] == b[j])

{

cout << a[i] << endl ;

++i ;

++j ;

}

else// a[i] > b[j]

++j ;

}

51.KVO鐨勫疄鐜板師鐞�?

绛�:KVO:褰撴寚瀹氱殑瀵硅薄鐨勫睘鎬ц淇敼浜嗭紝鍏佽瀵硅薄鎺ユ敹鍒伴�氱煡鐨勬満鍒躲��

52.濡備綍缁欎竴涓璞$殑绉佹湁灞炴�ц祴鍊�?

绛�:鍒╃敤KVC鍗抽敭鍊肩紪鐮佹潵缁欏璞$殑绉佹湁灞炴�ц祴鍊�.

53.block鐨勬湰璐ㄦ槸浠�涔�?涓哄暐鍦╞lock閲岄潰鏇存敼澶栭潰鍙橀噺鐨勫��,瑕佺粰澶栭潰鐨勫彉閲忓姞_block淇グ,鍔燺block淇グ鐨勫師鐞嗘槸浠�涔�?

绛�: (1) block鏈川鏄竴涓暟鎹被鍨�,澶氱敤浜庡弬鏁颁紶閫�,浠f浛浠g悊鏂规硶, (鏈夊涓弬鏁伴渶瑕佷紶閫掓垨鑰呭涓唬鐞嗘柟娉曢渶瑕佸疄鐜拌繕鏄帹鑽愪娇鐢ㄤ唬鐞嗘柟娉�),灏戠敤浜庡綋鍋氳繑鍥炲�间紶閫�. block鏄竴涓狾C瀵硅薄,瀹冪殑鍔熻兘鏄繚瀛樹唬鐮佺墖娈�,棰勫厛鍑嗗濂戒唬鐮�,骞跺湪闇�瑕佺殑鏃跺�欐墽琛�.

(2)鍥犱负浣跨敤block浠g爜鍧楀彲鑳戒細寮曡捣鍐呴儴寰潖寮曠敤,鎵�浠ュ簲鍦╞lock瀹氫箟鍓嶅姞涓婁慨楗�

54.block鍦ㄥ摢绉嶆儏鍐典笅浼氶�犳垚寰幆寮曠敤,濡備綍瑙e喅?

绛�:(1)浠庝袱鏂归潰鍒嗘瀽閫犳垚寰幆寮曠敤闂

褰搒elf鎷ユ湁涓�涓猙lock鐨勬椂鍊欙紝鍦╞lock鍙堣皟鐢╯elf鐨勬柟娉�(鎴栬�卻elf鎵�鎷ユ湁鐨勬煇涓睘鎬�)銆傚舰鎴愪綘涓湁鎴戯紝鎴戜腑鏈変綘锛岃繖绉嶆椂鍊欎細閫犳垚寰幆寮曠敤

鎶婃煇涓疄渚嬪彉閲忓彉鎴愭湰鍦颁复鏃跺彉閲�,寮哄紩鐢ㄥ皢鐩存帴鎸囧悜杩欎釜鏈湴涓存椂鍙橀噺,浣嗘湰鍦颁复鏃跺彉閲忎竴鑸兘浼氬緢蹇噴鏀�,鎵�浠ヤ竴鑸�冭檻绗竴绉嶆儏鍐�

(2)瑙e喅鏂规:瀵筨lock杩涜淇グ__weak(arc)鎴朹_block(mrc)

55.NSURLSession鍦ㄤ粈涔堟儏鍐典笅鍥炲瓨鍦ㄥ惊鐜紩鐢ㄧ殑闂,鎬庝箞瑙e喅?

绛�: (1)鍦ㄤ娇鐢∟SURLSession绛捐鍏朵唬鐞嗙殑鏃跺�欎細瀛樺湪寰幆寮曠敤闂锛屽洜涓哄叾浠g悊鏄痳etain寮哄紩鐢�

(2)瑙e喅鏂规

锛�1锛夊湪涓嬭浇瀹屾垚鍚庡彇娑圢SURLSession浼氳瘽骞堕噴鏀維ession锛岃祴鍊间负nil銆�

锛�2锛夊啀瑙嗗浘灏嗚娑堝け鏃朵篃鎵ц鍚屾牱鐨勬搷浣溿�備负浜嗛槻姝㈡病鏈変笅杞藉畬鎴愬氨璺宠浆鎺у埗鍣ㄣ��

鍏蜂綋濡備笅锛�

/**瑙嗗浘灏嗚娑堝け鐨勬椂鍊欙紝鍙栨秷session*/

- (void)viewWillDisappear:(BOOL)animated

{

[superviewWillDisappear:animated];

//浠诲姟瀹屾垚锛屽彇娑圢SURLSession

[self.sessioninvalidateAndCancel];

//閲婃斁浼氳瘽

self.session =nil;

}

56.濡備綍鑷繁瀹炵幇GET缂撳瓨?

绛�:1.浣跨敤GET璇锋眰鏁版嵁

2.iOS绯荤粺SDK宸茬粡鍋氬ソ浜嗙紦瀛樸�傞渶瑕佺殑浠呬粎鏄缃笅鍐呭瓨缂撳瓨澶у皬銆佺鐩樼紦瀛樺ぇ灏忋�佷互鍙婄紦瀛樿矾寰�,浠g爜濡備笅

NSURLCache *urlCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];

[NSURLCache setSharedURLCache:urlCache];

57.鍦ㄤ娇鐢⊿QLite杩囩▼涓�,濡傛灉澶氭潯绾跨▼鍚屾椂鎿嶄綔鍚屼竴鏁版嵁搴撲細閫犳垚浠�涔堥棶棰�,鎬庝箞瑙e喅?

绛�:(1)瀹规槗閫犳垚绯荤粺宕╂簝

(2)瑙e喅鏂规锛氬紑鍚3绉嶄覆琛屾ā寮忥紝浣跨敤涓�涓被锛堝崟渚嬫柟寮忥級鎿嶄綔鏁版嵁搴�銆�

58.濡傛灉鎻愪氦涓�涓狫son鏍煎紡鐨勬暟鎹粰鍚庡彴鏈嶅姟鍣�,鍚庡彴鏈嶅姟鍣ㄨ繑鍥炵殑鏄竴娈垫櫘閫氭枃瀛�,鐢∟SURLConnection/NSURLSession/AFN鍒嗗埆濡備綍瀹炵幇?

绛�:1.浣跨敤NSURLConnection鍙戦�佽姹傜殑姝ラ寰堢畝鍗�

锛�1锛夊垱寤轰竴涓狽SURL瀵硅薄锛岃缃姹傝矾寰勶紙璁剧疆璇锋眰璺緞锛�

锛�2锛変紶鍏SURL鍒涘缓涓�涓狽SURLRequest瀵硅薄锛岃缃姹傚ご鍜岃姹備綋锛堝垱寤鸿姹傚璞★級

锛�3锛変娇鐢∟SURLConnection鍙戦�丯SURLRequest锛堝彂閫佽姹傦級

2.浣跨敤NSURLSession鍙戦�佽姹傜殑姝ラ寰堢畝鍗�

1锛夌‘瀹氳姹傝矾寰勶紙涓�鑸敱鍏徃鐨勫悗鍙板紑鍙戜汉鍛樹互鎺ュ彛鏂囨。鐨勬柟寮忔彁渚涳級锛孏ET璇锋眰鍙傛暟鐩存帴璺熷湪URL鍚庨潰

2锛夊垱寤鸿姹傚璞★紙榛樿鍖呭惈浜嗚姹傚ご鍜岃姹傛柟娉曘�怗ET銆戯級锛屾姝ラ鍙互鐪佺暐

3锛夊垱寤轰細璇濆璞★紙NSURLSession锛�

4锛夋牴鎹細璇濆璞″垱寤鸿姹備换鍔★紙NSURLSessionDataTask锛�

5锛夋墽琛孴ask

6锛夊綋寰楀埌鏈嶅姟鍣ㄨ繑鍥炵殑鍝嶅簲鍚庯紝瑙f瀽鏁版嵁锛圶ML|JSON|HTTP锛�

59.璇锋弿杩颁竴涓婼DWebImage鍐呴儴瀹炵幇鐨勫師鐞�

绛�:SDWebImage搴曞眰瀹炵幇鏈夋矙鐩掔紦瀛樻満鍒讹紝涓昏鐢变笁鍧楃粍鎴�

1銆佸唴瀛樺浘鐗囩紦瀛�

2銆佸唴瀛樻搷浣滅紦瀛�

3銆佺鐩樻矙鐩掔紦瀛�

60.浣犲runtime閮芥湁鍝簺浜嗚В,浣犲湪瀹炵幇寮�鍙戣繃绋嬩腑,鎴栨槸浣犲湪鎵�浣跨敤鐨勭涓夋柟妗嗘灦涓�,鏈夋病鏈変娇鐢ㄨ繃runtime鐨�,濡傛灉鏈�,璇蜂綘鎻忚堪涓�涓嬪叾鍐呴儴瀹炵幇鏈哄埗

绛�:Runtime:runtime鏄竴濂楁瘮杈冨簳灞傜殑绾疌璇█API,灞炰簬1涓狢璇█搴�,鍖呭惈浜嗗緢澶氬簳灞傜殑C璇█API銆傚湪鎴戜滑骞虫椂缂栧啓鐨凮C浠g爜涓�,绋嬪簭杩愯杩囩▼鏃�,鍏跺疄鏈�缁堥兘鏄浆鎴愪簡runtime鐨凜璇█浠g爜, runtime绠楁槸OC鐨勫箷鍚庡伐浣滆��.

(http://www.w2bc.com/article/126999缃戝潃涓悳绱�:鍏跺疄鏈�缁堥兘鏄浆鎴愪簡runtime鐨凜璇█浠g爜)

61.绾跨▼闂存�庝箞閫氫俊?

锛�1锛塆CD锛�

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{

//涓嬭浇鍥剧墖

UIImage *image = nil;

dispatch_async(dispatch_get_main_queue(),^{

//鍥炲埌涓荤嚎绋�

});

锛�2锛塏SThread鐨勭嚎绋嬮�氫俊

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{

//涓嬭浇鍥剧墖

UIImage *image = nil;

[selfperformSelector:@selector(settingImage:) onThread:[NSThread mainThread]withObject:image waitUntilDone:YES modes:nil];

}

杩欑鎯呭喌涔熼�傜敤浜庡瓙绾跨▼涔嬮棿鐨勯�氫俊銆�

62.缃戠粶鍥剧墖澶勭悊闂涓�庝箞瑙e喅涓�涓浉鍚岀殑缃戠粶鍦板潃閲嶅璇锋眰鐨勯棶棰�?

绛旀:鍒╃敤瀛楀吀鍥剧墖鍦板潃涓簁ey锛屼笅杞芥搷浣滀负value

63.鑷姩閲婃斁姹犲簳灞傛�庝箞瀹炵幇?

绛�:鑷姩閲婃斁姹犱互鏍堢殑褰㈠紡瀹炵幇:褰撲綘鍒涘缓涓�涓柊鐨勮嚜鍔ㄩ噴鏀炬睜鏃�,瀹冨皢琚坊鍔犲埌鏍堥《.褰撲竴涓璞℃敹鍒板彂閫乤utorelease娑堟伅鏃�,浠栬娣诲姞鍒板綋鍓嶇嚎绋嬬殑澶勪簬鏍堥《鐨勮嚜鍔ㄩ噴鏀炬睜涓�,褰撹嚜鍔ㄩ噴鏀炬睜琚洖鏀舵椂,浠栦滑浠庢爤涓鍒犻櫎,骞朵笖浼氱粰姹犲瓙閲岄潰鎵�鏈夌殑瀵硅薄閮戒細鍋氫竴娆elease鎿嶄綔

64.涓嶇敤涓棿鍙橀噺,鐢ㄤ袱绉嶆柟娉曚氦鎹鍜孊鐨勫��

A = A+B;

B = A - B;

A = A - B;

65.绠�鍗曟弿杩颁竴涓嬪鎴风鐨勭紦瀛樻満鍒�?

绛旀:鏃犳硶绠�杩�,璇︾粏浜嗚В涓�,鏄庣櫧浜嗗瑁呴�煎氨濂絟ttp://www.cnblogs.com/wendingding/p/3950198.html

66.鎺у埗鍣╒iew鐨勭敓鍛藉懆鏈熷強鐩稿叧鍑芥暟鏄粈涔�?浣犲湪寮�鍙戜腑鏄浣曠敤鐨�?

>1.鍦ㄨ鍥炬樉绀轰箣鍓嶈皟鐢╲iewWillAppear;璇ュ嚱鏁板彲浠ヨ皟鐢ㄥ娆�;

>2.瑙嗗浘鏄剧ず瀹屾瘯,璋冪敤viewDidAppear;

>3.鍦ㄨ鍥炬秷澶变箣鍓嶈皟鐢╲iewWillDisAppear;璇ュ嚱鏁板彲浠ヨ皟鐢ㄥ娆�(濡傞渶瑕�);

>4.鍦ㄥ竷灞�鍙樺寲鍓嶅悗,璋冪敤viewWill/DidLayoutSubviews澶勭悊鐩稿叧淇℃伅;

67.NSRunLoop鐨勫疄鐜版満鍒�,鍙婂湪澶氱嚎绋嬩腑濡備綍浣跨敤?

绛旀:NSRunLoop鏄痠OS鐨勬秷鎭満鍒剁殑澶勭悊妯″紡

>1NSRunloop鐨勪富瑕佷綔鐢�:鎺у埗runloop閲岄潰绾跨▼鐨勬墽琛屽拰浼戠湢,鍦ㄦ湁浜嬫儏鍋氱殑鏃跺�欎娇鎸″NSRunloop鎺у埗鐨勭嚎绋嬪伐浣�,娌℃湁浜嬫儏鍋氳褰撳墠runloop鐨勬帶鍒剁嚎绋嬩紤鐪�.

>2.runloop灏辨槸涓�鐩村湪寰幆妫�娴�,浠庣嚎绋媠tart鍒扮嚎绋媏nd,妫�娴媔nputsourse(濡傜偣鍑�,鍙屽嚮绛夋搷浣�)寮傛鏃堕棿,妫�娴媡imesourse鍚屾浜嬩欢,瑙佸埌妫�娴嬪埌杈撳叆婧愪細鎵ц澶勭悊鍑芥暟锛岄鍏堜細浜х敓閫氱煡锛宑orefunction鍚戠嚎绋嬫坊鍔爎unloop observers鏉ョ洃鍚簨浠讹紝鎰忓湪鐩戝惉浜嬩欢鍙戠敓鏃舵潵鍋氬鐞嗐��

>3.runloopmode鏄竴涓泦鍚堬紝鍖呮嫭鐩戝惉锛氫簨浠舵簮锛屽畾鏃跺櫒锛屼互鍙婇渶閫氱煡鐨剅unloop observers

>1.鍙湁鍦ㄤ负浣犵殑绋嬪簭鍒涘缓娆$嚎绋嬬殑鏃跺�欙紝鎵嶉渶瑕佽繍琛宺un loop銆傚浜庣▼搴忕殑涓荤嚎绋嬭�岃█锛宺un loop鏄叧閿儴鍒嗐�侰ocoa鎻愪緵浜嗚繍琛屼富绾跨▼run loop鐨勪唬鐮佸悓鏃朵篃浼氳嚜鍔ㄨ繍琛宺un loop銆侷OS绋嬪簭UIApplication涓殑run鏂规硶鍦ㄧ▼搴忔甯稿惎鍔ㄧ殑鏃跺�欏氨浼氬惎鍔╮un loop銆傚鏋滀綘浣跨敤xcode鎻愪緵鐨勬ā鏉垮垱寤虹殑绋嬪簭锛岄偅浣犳案杩滀笉闇�瑕佽嚜宸卞幓鍚姩run loop

>2.鍦ㄥ绾跨▼涓紝浣犻渶瑕佸垽鏂槸鍚﹂渶瑕乺un loop銆傚鏋滈渶瑕乺un loop锛岄偅涔堜綘瑕佽礋璐i厤缃畆un loop骞跺惎鍔ㄣ�備綘涓嶉渶瑕佸湪浠讳綍鎯呭喌涓嬮兘鍘诲惎鍔╮un loop銆傛瘮濡傦紝浣犱娇鐢ㄧ嚎绋嬪幓澶勭悊涓�涓鍏堝畾涔夊ソ鐨勮�楁椂鏋侀暱鐨勪换鍔℃椂锛屼綘灏卞彲浠ユ瘚闇�鍚姩run loop銆俁un loop鍙湪浣犺鍜岀嚎绋嬫湁浜や簰鏃舵墠闇�瑕�

68.绠�鍗曡涓�涓婣PP鐨勫惎鍔ㄨ繃绋�,浠巑ain鏂囦欢寮�濮嬭璧�

杩涘叆main鍑芥暟锛屽湪main.m鐨刴ain鍑芥暟涓墽琛屼簡UIApplicationMain杩欎釜鏂规硶锛岃繖鏄痠os绋嬪簭鐨勫叆鍙g偣!

int UIApplicationMain(int argc, char argv[], NSString principalClassName, NSString *delegateClassName)

argc銆乤rgv锛欼SO C鏍囧噯main鍑芥暟鐨勫弬鏁帮紝鐩存帴浼犻�掔粰UIApplicationMain杩涜鐩稿叧澶勭悊鍗冲彲

principalClassName锛氭寚瀹氬簲鐢ㄧ▼搴忕被锛岃绫诲繀椤绘槸UIApplication(鎴栧瓙绫�)銆傚鏋滀负nil,鍒欑敤UIApplication绫讳綔涓洪粯璁ゅ��

delegateClassName锛氭寚瀹氬簲鐢ㄧ▼搴忕被鐨勪唬鐞嗙被锛岃绫诲繀椤婚伒瀹圲IApplicationDelegate鍗忚

姝ゅ嚱鏁颁細鏍规嵁principalClassName鍒涘缓UIApplication瀵硅薄锛屾牴鎹甦elegateClassName鍒涘缓涓�涓猟elegate瀵硅薄锛屽苟灏嗚delegate瀵硅薄璧嬪�肩粰UIApplication瀵硅薄涓殑delegate灞炴��

lUIApplication瀵硅薄浼氫緷娆$粰delegate瀵硅薄鍙戦�佷笉鍚岀殑娑堟伅锛屾帴鐫�浼氬缓绔嬪簲鐢ㄧ▼搴忕殑main runloop(浜嬩欢寰幆)锛岃繘琛屼簨浠剁殑澶勭悊(棣栧厛浼氳皟鐢╠elegate瀵硅薄鐨刟pplication:didFinishLaunchingWithOptions:)

绋嬪簭姝e父閫�鍑烘椂杩欎釜鍑芥暟鎵嶈繑鍥炪�傚鏋滆繘绋嬭琚郴缁熷己鍒舵潃姝伙紝涓�鑸繖涓嚱鏁拌繕娌℃潵寰楀強杩斿洖杩涚▼灏辩粓姝簡

69.绗笁鏂笰PI浣犳槸鎬庝箞鐢ㄧ殑?

cocoa pod瀵煎叆

70.鐢ㄩ澶勭悊鎸囦护#define澹版槑涓�涓父鏁�,鐢ㄤ互琛ㄦ槑涓�骞翠腑鏈夊灏戠?(蹇界暐闂板勾闂)

绛�:#define second 365*24*60*60

91.UITableView闇�瑕佸疄鐜板摢浜涗唬鐞�?鍒楀嚭UITableView浠g悊涓繀椤诲疄鐜扮殑涓庡叾浠栦竴浜涘父鐢ㄧ殑鍑芥暟.

绛�:

-( NSInteger )tableView:( UITableView *)tableViewnumberOfRowsInSection:( NSInteger)section;

涓�缁勬湁澶氬皯琛�

-( UITableViewCell *)tableView:( UITableView *)tableViewcellForRowAtIndexPath:(NSIndexPath *)indexPath;

姣忚涓殑cell鐨勫疄鐜颁互涓婁袱涓柟娉曚负蹇呴』瑕佸疄鐜扮殑

甯哥敤鐨勬湁

- ( void )tableView:( UITableView *)tableViewdidSelectRowAtIndexPath:( NSIndexPath*)indexPath

閫変腑浠ュ悗浜嬩欢璁剧疆

-( CGFloat )tableView:( UITableView *)tableViewheightForRowAtIndexPath:( NSIndexPath*)indexPath

璁剧疆cell鐨勯珮搴�

绛夌瓑銆傘�傘�傘�傘��

92.鍦╥OS涓婂紑鍙戜竴涓簲鐢ㄧ▼搴忔椂鎬庝箞鍋氱殑?

绛�:棣栧厛锛岃鏈変竴涓狹AC绯荤粺锛堜拱涓�鍙拌嫻鏋滅數鑴戯紝鑻规灉鏈垨鑰匨ACmini锛夛紝娌℃湁杩欎釜鏉′欢鍙互瑁呬竴涓粦鑻规灉鐨刴ac绯荤粺鎴栬�呰涓�涓櫄鎷熸満銆傜劧鍚庤涓�涓猉-CODE寮�鍙戠幆澧冦�傝鏄涔爄os寮�鍙戠殑璇濓紝杩欎簺灏卞彲浠ヤ簡銆傚鏋滆寮�鍙戙�佷笂绾跨殑璇濓紝灏卞緱鍑嗗iphone/ipod銆乮pad鍋氫负娴嬭瘯鏈猴紝鍒拌嫻鏋滅敵璇蜂竴涓紑鍙戣�呰处鍙凤紝姣忓勾鐨勫勾璐�99缇庡厓銆傚啀鐒跺悗鎺ョ潃灏卞彲浠ュ紑鍙戜綘鐨勭▼搴忎簡锛屽紑鍙戝畬姣曚箣鍚庯紝鍙戝竷鍒癆pp store涓婇潰锛岄�氳繃瀹℃牳灏卞彲浠ヤ簡銆�

*93.C++鍜孫bjective-C鐨勬贩鍚堜娇鐢�,浠ヤ笅鎻忚堪閿欒鐨勬槸()

//鏈壘鍒扮瓟妗堟垨鏄疌++JAVA

A. cpp鏂囦欢鍙兘浣跨敤C/C++浠g爜

B. cpp鏂囦欢include鐨勫ご鏂囦欢涓�,鍙互鍑虹幇objective-C鐨勪唬鐮�

C. mm鏂囦欢涓贩鐢╟pp鐩存帴浣跨敤鍗冲彲

D. cpp浣跨敤objective-C鐨勫叧閿槸浣跨敤鎺ュ彛,鑰屼笉鑳界洿鎺ヤ娇鐢ㄤ唬鐮�

*94.浠ヤ笅鍝竴娈典唬鐮佷笉浼氭姏鍑哄紓甯�( C& D )

A. NSArray *array = @[1, 2, 3];NSNumber*number = array[3];// @[@1,@ 2,@ 3]

B. NSDictionary *dict = @{@鈥漦ey鈥�:

nil};//value涓嶈兘涓虹┖

C. NSString *str = nil; NSString *str2 =[str substringFromIndex:3];

D. NSString *str = @鈥漢i鈥�;NSString *str2 =[str substringFromIndex:3];

*95.鍦ㄦ病鏈塶avigationController鐨勬儏鍐典笅,瑕佷粠涓�涓猇iewController鍒囨崲鍒板彟涓�涓猇iewController搴旇()

A.{self.navigationControllerpushViewController:nextViewController animated:YES};

B.{self .viewaddSubview:nextViewController}

C. {selfpresentModalViewController:nextViewController animated:YES};

D. {selfpushViewController:nextViewController animated:YES};

鍒嗘瀽:A銆丆閮介渶瑕佹湁navigationController,B涓�涓帶鍒跺櫒鐨剉iew鏄棤娉曞姞杞藉彟涓�涓帶鍒跺櫒鐨剉iew鐨勶紝鎵�浠ラ�塁锛�

*96.鍏充簬涓嬮潰绾跨▼绠$悊閿欒鐨勬槸()

//涓嶇‘瀹�

A.GCD鍦ㄥ悗绔鐞嗙潃涓�涓嚎绋嬫睜

B.NSOperationQueue鏄NSthread鐨勬洿楂樺眰鐨勫皝瑁�,瀵�

C.NSThread闇�瑕佽嚜宸辩鐞嗙嚎绋嬬殑鐢熷懡鍛ㄦ湡

D.GCD鍙互鏍规嵁涓嶅悓浼樺厛绾у垎閰嶇嚎绋�,瀵�

*97.iOS涓殑鏁版嵁鎸佷箙鍖栨柟寮�(D)

A.灞炴�у垪琛�

B.瀵硅薄褰掓。

C.SQLite鍜孋oreData

D.浠ヤ笂鍏ㄩ儴+瀵硅薄褰掓。

98.璁炬湁涓�涓嬪畯瀹氫箟:

#defineN4

#defineY(n)((N + 1) * n)

鍒欐墽琛岃鍙�: Y(5 + 1)涓�:(26)

99.濡備笅绋嬪簭鐢ㄤ簬鎶婏紓blue锛傚瓧绗︿覆杩斿洖,璇锋寚鍑哄叾涓殑閿欒.

//涓嶇‘瀹�

char *GetBlue()

{

char *pcColor;

char*pcNewColor;

pcColor = 鈥渂lue鈥�;

pcNewColor =(char*)malloc(strlen(pcColor));

strcpy(pcNewColor, pcColor);

return pcNewColor;

}

绛�:strcpy鏄竴涓瓧绗︿覆鎷疯礉鐨勫嚱鏁�,瀹冪殑鍑芥暟鍘熷瀷涓簊trcpy(char *dst, c*****t char *src);灏唖rc寮�濮嬬殑涓�娈靛瓧绗︿覆鎷疯礉鍒癲st寮�濮嬬殑鍐呭瓨涓幓,缁撴潫鐨勬爣蹇楃鍙蜂负'\0',鐢变簬鎷疯礉鐨勯暱搴︿笉鏄敱鎴戜滑鎺у埗鐨�,鎵�浠ヨ繖涓瓧绗︿覆鎷疯礉寰堝鏄撳嚭閿�

100.甯歌鐨刼bject-c鐨勬暟鎹被鍨嬫湁鍝簺,鍜孋鐨勫熀鏈暟鎹被鍨嬫湁浠�涔堝尯鍒�?濡�:NSInteger鍜宨nt

绛�:object鐨勬暟鎹被鍨嬬敱NSString,NSNumber,NSArray,NSMutableArray,NSData绛夌瓑锛岃繖浜涢兘鏄痗lass锛屽垱寤哄悗渚挎槸瀵硅薄锛岃�孋璇█鐨勫熀鏈暟鎹被鍨媔nt锛屽彧鏄竴瀹氬瓧鑺傜殑鍐呭瓨绌洪棿锛岀敤浜庡瓨鏀炬暟鍊硷紝NSInteger鏄熀鏈殑鏁版嵁绫诲瀷锛屽苟涓嶆槸NSNumber鐨勫瓙绫伙紝褰撶劧涔熶笉鏄疦SObject鐨勫瓙绫汇�侼SInteger鏄熀鏈暟鎹被鍨媔nt鎴栬�匧ong鐨勫埆鍚嶏紙NSInteger鐨勫畾涔塼ypedef long NSInteger锛夊畠鐨勫尯鍒湪浜庯紝NSInteger浼氭牴鎹郴缁熸槸32浣嶈繕鏄�64浣嶆潵鍐冲畾鏄湰韬玦nt杩樻槸long.

101.iOS鏈夊瀮鍦惧洖鏀舵満鍒跺悧?瀹冩槸浠ユ�庢牱鐨勬満鍒舵潵宸ヤ綔鐨�?

绛�: OC鏄敮鎸佸瀮鍦惧洖鏀舵満鍒剁殑(Garbage collection绠�绉癎C),浣嗘槸apple鐨勭Щ鍔ㄧ粓绔腑,鏄笉鏀寔GC鐨�,Mac妗岄潰绯荤粺寮�鍙戜腑鏄敮鎸佺殑.

绉诲姩缁堢寮�鍙戞槸鏀寔ARC锛圓utomatic

Reference Counting鐨勭畝绉帮級,ARC鏄湪IOS5涔嬪悗鎺ㄥ嚭鐨勬柊鎶�鏈�,瀹冧笌GC鐨勬満鍒舵槸涓嶅悓鐨勩�傛垜浠湪缂栧啓浠g爜鏃�,涓嶉渶瑕佸悜瀵硅薄鍙戦�乺elease鎴栬�卆utorelease鏂规硶,涔熶笉鍙互璋冪敤delloc鏂规硶,缂栬瘧鍣ㄤ細鍦ㄥ悎閫傜殑浣嶇疆鑷姩缁欑敤鎴风敓鎴恟elease娑堟伅(autorelease),ARC鐨勭壒鐐规槸鑷姩寮曠敤鎶�鏈畝鍖栦簡鍐呭瓨绠$悊鐨勯毦搴�.

102.璇蜂娇鐢╣cd瀹屾垚濡備笅浠诲姟,鎵ц骞跺彂浠诲姟task1,task1瀹屾垚鍚巙pdate UI.

绛�:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{

//task1:

NSLog(@"鎵цtask1");

//鏇存柊UI

dispatch_async(dispatch_get_main_queue(), ^{

NSLog(@"鏇存柊UI");

});

});

103.涓轰粈涔堝湪涓荤嚎绋嬩腑鏇存柊UI?瀛愮嚎绋嬩腑鎯宠鏇存柊UI鎬庝箞鍋�?

绛旓細锛�1锛夊湪瀛愮嚎绋嬩腑涓嶈兘鏇存柊UI锛岄櫎浜嗘瀬灏戞暟UI澶栵紝鍏朵粬UI鏇存柊瑕佺瓑鍒板瓙绾跨▼鎵ц瀹屾瘯鍚庡洖鍒颁富绾跨▼涓繘琛屾洿鏂般�傚鏋滃瓙绾跨▼涓�鐩村湪杩愯锛屽垯瀛愮嚎绋嬩腑UI鏇存柊鐨勫嚱鏁版爤涓荤嚎绋嬫棤娉曞緱鐭ワ紝鍗砋I鏃犳硶鏇存柊锛�

锛�2锛夊洖鍒颁富绾跨▼涓繘琛孶I鏇存柊锛�

104.绠�杩伴�氳繃Storyboard瀹炵幇涓�涓猼ableView

(鑷畾涔塩ell鐨勫叧閿楠�).

绛�:棣栧厛鍒涘缓鑷繁鐨勮嚜瀹氫箟cell鐨勭被锛屾垜浠彨鍋欳ustomCell锛岃缁ф壙浜嶶ITableViewCell銆傚湪杩欎釜绫讳腑瀹氫箟鑷繁鎵�闇�瑕佺殑鎺т欢銆�

鐒跺悗锛屾墦寮�storyboard锛岄�夋嫨鑷繁瑕佹坊鍔犺嚜瀹氫箟cell鐨刄IViewController锛屾垜浠彨瀹冧负ViewController銆傚湪UITableView閲岄潰娣诲姞涓�涓猚ell锛堟垨鑰呬慨鏀瑰師鏈夌殑cell锛夈�傚皢cell鐨剆tyle鏀逛负custom锛屽皢cell鐨勭被鏀逛负CustomCell锛屽皢identifier鏀逛负CustomCellIdentifier銆傜劧鍚庯紝鍙互鍦╟ell涓坊鍔犳帶浠讹紝灏嗘帶浠跺拰鍒氭墠鍦–ustomCell涓畾涔夌殑鎺т欢杩炶捣鏉ャ��

鏈�鍚庯紝鍦╒iewController鐨刄ITableView鐨則ableView:cellForRowAtIndexPath:浠g悊鏂规硶涓坊鍔犱互涓嬩唬鐮侊細

[plain]

CustomCell*cell=[tableViewdequeueReusableCellWithIdentifier:@"CustomCellIdentifier"];

杩欐牱锛屽氨鍒涘缓浜嗕竴涓猚ell锛屽彲浠ュ湪杩欏彞浠g爜涔嬪悗瀵硅嚜宸辨坊鍔犵殑鎺т欢杩涜璁剧疆銆�

105.濡備綍鐢熸垚鍚屾椂鏀寔澶氫釜鏋舵瀯(simulator,arm7,arm64)鐨勯�氱敤闈欐�佸簱?

绛�:ValidArchitectures璁剧疆涓猴細armv7锝渁rmv7s锝渁rm64锝渋386锝渪86_64锛�

Architectures璁剧疆涓嶅彉锛堟垨鏍规嵁浣犻渶瑕侊級:armv7锝渁rm64锛�

鐒跺悗鍒嗗埆閫夋嫨iOS璁惧鍜屾ā鎷熷櫒杩涜缂栬瘧锛屾渶鍚庢壘鍒扮浉鍏崇殑.a杩涜鍚堝寘锛屼娇鐢╨ipo -create鐪熸満搴�.a鐨勮矾寰勬ā鎷熷櫒搴�.a鐨勭殑璺緞锛峯utput鍚堟垚搴撶殑鍚嶅瓧.a锛�

杩欐牱灏卞埗浣滀簡涓�涓�氱敤鐨勯潤鎬佸簱.a锛�

106.璇峰啓鍑轰竴涓獂ml鏂囦欢,鐢ㄤ簬鎻忚堪涓�涓功鏋�,涔︽灦涓婃湁2鏈功,涔︽湰鐨勭被鍒�(category)鍒嗗埆鏄痗ooking,children.瑕佹眰tag涓寘鍚功鍚�(title),浣滆��(author).绫诲埆(category)瑕佺敤灞炴�ц〃绀�.

绛�:

涔﹀悕1<\title>

浣滆��1<\author>

<\book>

涔﹀悕2<\title>

浣滆��2<\author>

<\book>

107.strcpy鍜宮emcpy鐨勬渶澶у尯鍒槸浠�涔�?

绛�:1銆佸鍒剁殑鍐呭涓嶅悓銆俿trcpy鍙兘澶嶅埗瀛楃涓诧紝鑰宮emcpy鍙互澶嶅埗浠绘剰鍐呭锛屼緥濡傚瓧绗︽暟缁勩�佹暣鍨嬨�佺粨鏋勪綋銆佺被绛夈��

2銆佸鍒剁殑鏂规硶涓嶅悓銆俿trcpy涓嶉渶瑕佹寚瀹氶暱搴︼紝瀹冮亣鍒拌澶嶅埗瀛楃鐨勪覆缁撴潫绗�"\0"鎵嶇粨鏉燂紝鎵�浠ュ鏄撴孩鍑恒�俶emcpy鍒欐槸鏍规嵁鍏剁

3涓弬鏁板喅瀹氬鍒剁殑闀垮害銆�

3銆佺敤閫斾笉鍚屻�傞�氬父鍦ㄥ鍒跺瓧绗︿覆鏃剁敤strcpy锛岃�岄渶瑕佸鍒跺叾浠栫被鍨嬫暟鎹椂鍒欎竴鑸敤memcpy

108.g++, ld鏄粈涔�?澹版槑缂栬瘧閫夐」鈥揇SUPPORT_BLUETOOTH =

1鏈変粈涔堜綔鐢�?

绛�: g++鏄疓NU鐨刢++缂栬瘧鍣�;

109.@class鐢ㄩ��

绛�:@class涓�鑸敤浜庡ご鏂囦欢涓0鏄庢煇涓被鐨勫疄渚嬪彉閲忕殑鏃跺�欑敤鍒�.瀹冨彧鏄0鏄�,鑷充簬鍐呴儴鐨勫疄鐜版槸娌℃湁鍛婅瘔缂栬瘧鍣ㄧ殑.

110.delegate浣跨敤assign or retain绠�杩扮悊鐢�.

绛旓細assign锛岄槻姝㈠嚭鐜板惊鐜紩鐢紱

111.NSString涓嶯SData涔嬮棿鐨勮浆鎹㈣繃绋嬩腑瑕佺壒鍒敞鎰忕殑浜嬮」鏄粈涔�?

瑙�:NSString杞崲鎴怤SData瀵硅薄

NSData* xmlData = [@"testdata"dataUsingEncoding:NSUTF8StringEncoding];

NSData杞崲鎴怤SString瀵硅薄

NSData * data;

NSString *result = [[NSString alloc] initWithData:data聽 encoding:NSUTF8StringEncoding];

NSData杞崲鎴恈har*

NSData *data;

char *test=[data bytes];

char*杞崲鎴怤SData瀵硅薄

byte* tempData = malloc(sizeof(byte)*16);

NSData *content=[NSData dataWithBytes:tempData length:16];

杞崲杩囩▼涓娉ㄦ剰NSData鐨勭紪鐮佹牸寮忛棶棰�.

瑙e喅鏂规硶:

鍏堣缃柇鐐圭劧鍚庡湪鎺у埗鍙皃o鍑篘SData鐨勫彉閲忥紝鐪嬬湅浼氭樉绀轰粈涔堛��

濡傛灉po鍑虹殑NSData鏄彲闃呰鐨勶紝鐩存帴鑳界湅鍒版枃鏈殑鍐呭锛屽垯浣跨敤[NSString stringWithFormat:NSData] (杩欓噷鐨凬SData鎸囩殑鏄綘闇�瑕佽浆鎹㈡垚NSString鐨凬SData鍙橀噺)鍗冲彲銆�

濡傛灉po鍑虹殑NSData鏄笉鍙槄璇荤殑涔辩爜锛岄偅涓�鑸兘鏄湁缂栫爜鏍煎紡鐨勶紝鏈�甯哥敤鐨勬槸NSUTF8StringEncoding锛屽彟澶栬繕鏈塏SASCIIStringEncoding绛夛紝浣犲彲浠ュ湪Apple鏂囨。閲屾壘鍒扮紪鐮佹牸寮忕殑閭d釜鏋氫妇绫诲瀷锛屾尐涓皾璇曘��

112.璇风敤浠g爜濡備綍鍒ゆ柇鏌愪釜瀵硅薄obj鏄惁鏀寔鏌愪釜method.

瑙�:if ([srespondsToSelector:@selector(print:)]) {

[s print:@"鏀寔杩欎釜鏂规硶"];

}

113.璇风敤绠�鍗曠殑浠g爜灞曠ず@protocol鐨勫畾涔夊強瀹炵幇.

瑙�: #warning浠g悊绗竴姝�:澹版槑鍗忚

@protocol MarryMe

-(void)makeMoney;

@end

#warning浠g悊绗簩姝�:澹版槑浠g悊

@property(nonatomic,assign)id myDeleget;

.m鏂囦欢涓�

#warning浠g悊绗笁姝�:浠g悊浜烘墽琛屽崗璁柟娉�

[self.myDeleget makeMoney];

浠g悊浜�.m鏂囦欢涓�

#warning浠g悊绗洓姝�:绛捐鍗忚

@interface Boy : NSObject

Girl *girl = [[Girl alloc] init];

#warning浠g悊绗簲姝�:鎴愪负浠g悊浜�

girl.myDeleget = self;

[girl getMessage:message];

#warning鍗忚浠g悊绗叚姝�:瀹炵幇鍗忚鏂规硶

-(void)makeMoney{

NSLog(@"aaa");

}

/*涓嶆槸iOS鐨勯*/114.璇疯杩癐ndesign涓富椤典綔鐢�

115.璇锋弿杩板簲鑱樺矖浣嶇殑鏈潵鑱屼笟瑙勫垝

瑙�:绛旀涓嶅敮涓�,濡傛湁闇�瑕佽鑷瑙勫垝娲荤潃鐧惧害.

116.3鍗囩殑鏉瓙涓�涓�,5鍗囩殑鏉瓙涓�涓�,鏉瓙鐨勫舰鐘朵笉瑙勫垯,闂�庝箞鎵嶈兘寰楀埌4鍗囩殑姘�,姘存棤闄愬.(璇峰啓鍑烘帹鐞嗚繃绋�)

瑙�:鍏堝皢5鍗囩殑鏉瓙鍊掓弧,鐒跺悗鎶�5鍗囩殑鏉瓙涓殑姘村�掑叆3鍗囩殑鏉瓙,鍊掓弧鍚�5鍗囩殑鏉瓙鍓╀笅2鍗�.鍐嶆妸3鍗囨澂瀛愪腑鐨勬按鍊掓帀,鎶�5鍗囩殑鏉瓙涓墿浣欑殑2鍗囨按鍊掑叆3鍗囩殑鏉瓙涓�,鐒跺悗鎶�5鍗囩殑鏉瓙鍊掓弧.鍐嶇敤5鍗囩殑鏉瓙涓殑姘寸粰3鍗囩殑鏉瓙娣绘弧,鍒�5鍗囩殑鏉瓙涓墿浣�4鍗囩殑姘�.

117.鏁版嵁鎸佷箙鍖栧瓨鍌ㄦ柟妗堟湁鍝簺锛�

瑙�:鎵�璋撶殑鎸佷箙鍖栵紝灏辨槸灏嗘暟鎹繚瀛樺埌纭洏涓紝浣垮緱鍦ㄥ簲鐢ㄧ▼搴忔垨鏈哄櫒閲嶅惎鍚庡彲浠ョ户缁闂箣鍓嶄繚瀛樼殑鏁版嵁銆傚湪iOS寮�鍙戜腑锛屾暟鎹寔涔呭寲鐨勬柟妗堟湁5绉嶆柟妗堬細

plist鏂囦欢锛堝睘鎬у垪琛級

preference锛堝亸濂借缃級

NSKeyedArchiver锛堝綊妗o級

SQLite 3

CoreData

118.缃戠粶閫氫俊鐢ㄨ繃鍝簺鏂瑰紡锛�

瑙�: ios璁惧鐨勭綉缁滈�氫俊鐨勬柟娉曪紝鏈夊涓嬩袱涓ぇ绫伙細

1銆佷娇鐢╯ocket鐨勬柟寮忚繘琛岄�氫俊銆�

2銆佷娇鐢╝synsocket绫诲簱杩涜閫氫俊銆�

119.濡備綍澶勭悊澶氫釜缃戠粶璇锋眰骞跺彂鐨勬儏鍐碉紵

瑙�: //浜嗚В(骞跺彂)褰撴湁澶氫釜绾跨▼鍦ㄦ搷浣滄椂,濡傛灉绯荤粺鍙湁涓�涓狢PU,鍒欏畠鏍规湰涓嶅彲鑳界湡姝e悓鏃惰繘琛屼竴涓互涓婄殑绾跨▼锛屽畠鍙兘鎶奀PU杩愯鏃堕棿鍒掑垎鎴愯嫢骞蹭釜鏃堕棿娈�,鍐嶅皢鏃堕棿娈靛垎閰嶇粰鍚勪釜绾跨▼鎵ц锛屽湪涓�涓椂闂存鐨勭嚎绋嬩唬鐮佽繍琛屾椂锛屽叾瀹冪嚎绋嬪浜庢寕璧风姸銆�.杩欑鏂瑰紡鎴戜滑绉颁箣涓哄苟鍙�(Concurrent)銆�

閬囧埌杩欑鎯呭喌寤鸿浣跨敤绗笁鏂圭殑缃戠粶搴撱�傛瘮濡侫FNetworking銆備篃鍙互閫氳繃GCD鍜孨SOperationQueue鏉ユ帶鍒跺苟鍙�

120.绠�鍗曚粙缁嶄竴涓婯VC鍜孠VO锛屼粬浠兘鍙互搴旂敤鍦ㄥ摢浜涘満鏅紵

瑙�: KVO:閿�肩洃鍚�,瑙傚療鏌愪竴灞炴�х殑鏂规硶

KVC:閿�肩紪鐮�,鏄竴绉嶉棿鎺ヨ闂璞$殑灞炴��

121.璁茶堪涓�涓媟untime鐨勬蹇碉紝message

send濡傛灉瀵绘壘涓嶅埌鍝嶅簲鐨勫璞★紝浼氬浣曪紵

Objc Runtime鍏跺疄鏄竴涓猂untime搴擄紝瀹冨熀鏈笂鏄敤C鍜屾眹缂栧啓鐨勶紝杩欎釜搴撲娇寰桟璇█鏈変簡闈㈠悜瀵硅薄鐨勮兘鍔涖��

122. iOS鑳藉惁宓屽叆鍏朵粬璇█?濡備綍瀹炵幇?

涓嶄細!!!!!

123. iOS绉诲姩寮�鍙戞渶缁堢敓鎴愮殑鏄粈涔堟枃浠�?鍏剁粨鏋勫浣�?

鏈�鍚庢墦鍖呭畬鎴愭槸涓�涓�.ipa鏂囦欢鍙互閫氳繃iTunes鍜屽叾浠栧伐鍏峰鏈夋祴璇曡祫鏍肩殑鎵嬫満杩涜瀹夎

124. UINavigationController濡備綍瑕佷娇鐢╬ush/pop鍔熻兘鐨勮瘽,闇�瑕佹�庝箞瀹炵幇

1.鐢║INavigationController鐨勬椂鍊欑敤pushViewController:animated

----杩斿洖涔嬪墠鐨勮鍥綶[selfnavigationController] popViewControllerAnimated:YES];

---ps锛歱ush浠ュ悗浼氬湪navigation鐨刲eft bar鑷姩娣诲姞back鎸夐挳锛屽畠鐨勫搷搴旀柟娉曞氨鏄繑鍥炪�傛墍浠ヤ竴鑸笉闇�瑕佸啓杩斿洖鏂规硶锛岀偣back鎸夐挳鍗冲彲銆�

2.鍏朵粬鏃跺�欑敤presentModalViewController:animated

[selfpresentModalViewController:controller animated:YES];//YES鏈夊姩鐢绘晥鏋�

-----杩斿洖涔嬪墠鐨勮鍥綶selfdismissModalViewControllerAnimated:YES];

3.鍒囨崲瑙嗗浘涓�鑸敤涓嶅埌addSubview

UINavigationController鏄鑸帶鍒跺櫒锛屽鏋減ushViewController鐨勮瘽锛屼細璺宠浆鍒颁笅涓�涓猇iewController锛岀偣杩斿洖浼氬洖鍒扮幇鍦ㄨ繖涓猇iewController锛�

濡傛灉鏄痑ddSubview鐨勮瘽锛屽叾瀹炶繕鏄褰撳墠鐨刅iewController鎿嶄綔锛屽彧鏄湪褰撳墠瑙嗗浘涓婇潰鍙堚�滅洊鈥濅綇浜嗕竴灞傝鍥撅紝鍏跺疄鍘熸潵鐨勭敾闈㈠湪涓嬮潰鍛紝鐪嬩笉鍒拌�屽凡銆�

125. UIView濡備綍闇�瑕侀噸鏂扮粯鍒舵暣涓晫闈�,闇�瑕佽皟鐢ㄤ粈涔堟柟娉�?

UIView setNeedsDisplay鍜宻etNeedsLayout鏂规硶銆傞鍏堜袱涓柟娉曢兘鏄紓姝ユ墽琛岀殑銆傝�宻etNeedsDisplay浼氳皟鐢ㄨ嚜鍔ㄨ皟鐢╠rawRect鏂规硶锛岃繖鏍峰彲浠ユ嬁鍒癠IGraphicsGetCurrentContext锛屽氨鍙互鐢荤敾浜嗐�傝�宻etNeedsLayout浼氶粯璁よ皟鐢╨ayoutSubViews锛屽氨鍙互澶勭悊瀛愯鍥句腑鐨勪竴浜涙暟鎹��

缁间笂鎵�杩帮細setNeedsDisplay鏂逛究缁樺浘锛岃�宭ayoutSubViews鏂逛究鍑烘潵鏁版嵁

setNeedDisplay鍛婄煡瑙嗗浘瀹冨彂鐢熶簡鏀瑰彉锛岄渶瑕侀噸鏂扮粯鍒惰嚜韬紝灏辩浉褰撲簬鍒锋柊鐣岄潰.

126. Plist鏂囦欢?缁撴瀯鏄�?

Plist鏂囦欢閫氬父鐢ㄤ簬鍌ㄥ瓨鐢ㄦ埛璁剧疆锛屼篃鍙互鐢ㄤ簬瀛樺偍鎹嗙粦鐨勪俊鎭紝璇ュ姛鑳藉湪鏃у紡鐨凪ac OS涓槸鐢辫祫婧愬垎鏀彁渚涚殑銆�

Plist涓昏鏈塁ore Fundation绫诲瀷鏋勬垚,涔熷彲浠ュ皢杩欎簺绫诲瀷鏀惧叆NSDictionary鍜孨SArray浠ヤ究鍚庡鏇村鏉傜殑鏁版嵁绫诲瀷

127. iOS閲岄潰鐨勪簩杩涘埗鏁版嵁绫诲瀷鏄粈涔�?鍜孨SString濡備綍浜掔浉杞崲?

NSData:鐢ㄤ簬瀛樺偍浜岃繘鍒剁殑鏁版嵁绫诲瀷

NSData绫绘彁渚涗簡涓�绉嶇畝鍗曠殑鏂瑰紡锛屽畠鐢ㄦ潵璁剧疆缂撳啿鍖恒�佸皢鏂囦欢鐨勫唴瀹硅鍏ョ紦鍐插尯锛屾垨灏嗙紦鍐插尯鐨勫唴瀹瑰啓鍒颁竴涓枃浠躲��

涓嶅彉缂撳啿鍖猴紙NSData绫伙級锛屼篃鍙畾涔夊彲鍙樼殑缂撳啿鍖猴紙NSMutableData绫伙級銆�

NSData銆丯SString浜掕浆锛�

NSData * data = [str dataUsingEncoding:NSUTF8StringEncoding];

//NSString杞崲鎴怤SData绫诲瀷

NSString * newStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];

128. iOS閲岄潰鏄惁鏈塆BK鐨勫瓧绗︾紪鐮佹弿杩�?鍗砃SUTF8StringEncoding濡傛灉鏈�,鏄�庢牱鐨�?

涓嶄細

129. iOS閲岄潰鐨勬墜鍔挎槸濡備綍瀹炵幇鐨�?

130.璋堣皥浣犱簡瑙g殑璁捐妯″紡,浣犵敤杩囧摢浜�,浠栦滑鐨勭己鐐�

1.MVC:浼樼偣锛�

1銆佸紑鍙戜汉鍛樺彲浠ュ彧鍏虫敞鏁翠釜缁撴瀯涓殑鍏朵腑鏌愪竴灞傦紱

2銆佸彲浠ュ緢瀹规槗鐨勭敤鏂扮殑瀹炵幇鏉ユ浛鎹㈠師鏈夊眰娆$殑瀹炵幇锛�

3銆佸彲浠ラ檷浣庡眰涓庡眰涔嬮棿鐨勪緷璧栵紱

4銆佹湁鍒╀簬鏍囧噯鍖栵紱

5銆佸埄浜庡悇灞傞�昏緫鐨勫鐢ㄣ��

缂虹偣:

1銆侀檷浣庝簡绯荤粺鐨勬�ц兘銆傝繖鏄笉瑷�鑰屽柣鐨勩�傚鏋滀笉閲囩敤鍒嗗眰寮忕粨鏋勶紝寰堝涓氬姟鍙互鐩存帴閫犺鏁版嵁搴擄紝浠ユ鑾峰彇鐩稿簲鐨勬暟鎹紝濡備粖鍗村繀椤婚�氳繃涓棿灞傛潵瀹屾垚銆�

2銆佹湁鏃朵細瀵艰嚧绾ц仈鐨勪慨鏀广�傝繖绉嶄慨鏀瑰挨鍏朵綋鐜板湪鑷笂鑰屼笅鐨勬柟鍚戙�傚鏋滃湪琛ㄧず灞備腑闇�瑕佸鍔犱竴涓姛鑳斤紝涓轰繚璇佸叾璁捐绗﹀悎鍒嗗眰寮忕粨鏋勶紝鍙兘闇�瑕佸湪鐩稿簲鐨勪笟鍔¢�昏緫灞傚拰鏁版嵁璁块棶灞備腑閮藉鍔犵浉搴旂殑浠g爜銆�

2.瑙傚療鑰呮ā寮忎紭鐐癸細

1銆佽瀵熻�呮ā寮忓湪琚瀵熻�呭拰瑙傚療鑰呬箣闂村缓绔嬩竴涓娊璞$殑鑰﹀悎銆傝瑙傚療鑰呰鑹叉墍鐭ラ亾鐨勫彧鏄竴涓叿浣撹瀵熻�呭垪琛紝姣忎竴涓叿浣撹瀵熻�呴兘绗﹀悎涓�涓娊璞¤瀵熻�呯殑鎺ュ彛銆傝瑙傚療鑰呭苟涓嶈璇嗕换浣曚竴涓叿浣撹瀵熻�咃紝瀹冨彧鐭ラ亾瀹冧滑閮芥湁涓�涓叡鍚岀殑鎺ュ彛銆�

鐢变簬琚瀵熻�呭拰瑙傚療鑰呮病鏈夌揣瀵嗗湴鑰﹀悎鍦ㄤ竴璧凤紝鍥犳瀹冧滑鍙互灞炰簬涓嶅悓鐨勬娊璞″寲灞傛銆傚鏋滆瑙傚療鑰呭拰瑙傚療鑰呴兘琚墧鍒颁竴璧凤紝閭d箞杩欎釜瀵硅薄蹇呯劧璺ㄨ秺鎶借薄鍖栧拰鍏蜂綋鍖栧眰娆°��

2銆佽瀵熻�呮ā寮忔敮鎸佸箍鎾�氳銆傝瑙傚療鑰呬細鍚戞墍鏈夌殑鐧昏杩囩殑瑙傚療鑰呭彂鍑洪�氱煡锛�

瑙傚療鑰呮ā寮忕己鐐癸細

1銆佸鏋滀竴涓瑙傚療鑰呭璞℃湁寰堝鐨勭洿鎺ュ拰闂存帴鐨勮瀵熻�呯殑璇濓紝灏嗘墍鏈夌殑瑙傚療鑰呴兘閫氱煡鍒颁細鑺辫垂寰堝鏃堕棿銆�

2銆佸鏋滃湪琚瀵熻�呬箣闂存湁寰幆渚濊禆鐨勮瘽锛岃瑙傚療鑰呬細瑙﹀彂瀹冧滑涔嬮棿杩涜寰幆璋冪敤锛屽鑷寸郴缁熷穿婧冦�傚湪浣跨敤瑙傚療鑰呮ā寮忔槸瑕佺壒鍒敞鎰忚繖涓�鐐广��

3銆佸鏋滃瑙傚療鑰呯殑閫氱煡鏄�氳繃鍙﹀鐨勭嚎绋嬭繘琛屽紓姝ユ姇閫掔殑璇濓紝绯荤粺蹇呴』淇濊瘉鎶曢�掓槸浠ヨ嚜鎭扮殑鏂瑰紡杩涜鐨勩��

4銆佽櫧鐒惰瀵熻�呮ā寮忓彲浠ラ殢鏃朵娇瑙傚療鑰呯煡閬撴墍瑙傚療鐨勫璞″彂鐢熶簡鍙樺寲锛屼絾鏄瀵熻�呮ā寮忔病鏈夌浉搴旂殑鏈哄埗浣胯瀵熻�呯煡閬撴墍瑙傚療鐨勫璞℃槸鎬庝箞鍙戠敓鍙樺寲鐨勩��

3.鍗曚緥妯″紡:涓昏浼樼偣锛�

1銆佹彁渚涗簡瀵瑰敮涓�瀹炰緥鐨勫彈鎺ц闂��

2銆佺敱浜庡湪绯荤粺鍐呭瓨涓彧瀛樺湪涓�涓璞★紝鍥犳鍙互鑺傜害绯荤粺璧勬簮锛屽浜庝竴浜涢渶瑕侀绻佸垱寤哄拰閿�姣佺殑瀵硅薄鍗曚緥妯″紡鏃犵枒鍙互鎻愰珮绯荤粺鐨勬�ц兘銆�

3銆佸厑璁稿彲鍙樻暟鐩殑瀹炰緥銆�

3.鍗曚緥妯″紡:涓昏缂虹偣锛�

1銆佺敱浜庡崟鍒╂ā寮忎腑娌℃湁鎶借薄灞傦紝鍥犳鍗曚緥绫荤殑鎵╁睍鏈夊緢澶х殑鍥伴毦銆�

2銆佸崟渚嬬被鐨勮亴璐h繃閲嶏紝鍦ㄤ竴瀹氱▼搴︿笂杩濊儗浜嗏�滃崟涓�鑱岃矗鍘熷垯鈥濄��

3銆佹互鐢ㄥ崟渚嬪皢甯︽潵涓�浜涜礋闈㈤棶棰橈紝濡備负浜嗚妭鐪佽祫婧愬皢鏁版嵁搴撹繛鎺ユ睜瀵硅薄璁捐涓虹殑鍗曚緥绫伙紝鍙兘浼氬鑷村叡浜繛鎺ユ睜瀵硅薄鐨勭▼搴忚繃澶氳�屽嚭鐜拌繛鎺ユ睜婧㈠嚭锛涘鏋滃疄渚嬪寲鐨勫璞¢暱鏃堕棿涓嶈鍒╃敤锛岀郴缁熶細璁や负鏄瀮鍦捐�岃鍥炴敹锛岃繖灏嗗鑷村璞$姸鎬佺殑涓㈠け.

131.鏁版嵁鎸佷箙鍖栧瓨鍌ㄦ柟妗堟湁鍝簺?

绛�:

(闄勭綉鍧�:http://www.cocoachina.com/industry/20130328/5908.html)

iOS涓殑鏁版嵁鎸佷箙鍖栨柟寮忥紝鍩烘湰涓婃湁浠ヤ笅鍥涚锛氬睘鎬у垪琛ㄣ�佸璞″綊妗c�丼QLite3鍜孋ore Data

1.灞炴�у垪琛�(NSUserDefaults锛岀敤浜庡瓨鍌ㄩ厤缃俊鎭�)

娑夊強鍒扮殑涓昏绫伙細NSUserDefaults,涓�鑸琜NSUserDefaults standardUserDefaults]灏卞鐢ㄤ簡

2.瀵硅薄褰掓。

瑕佷娇鐢ㄥ璞″綊妗�,瀵硅薄蹇呴』瀹炵幇NSCoding鍗忚.澶ч儴鍒哋bject C瀵硅薄閮界鍚圢SCoding鍗忚,涔熷彲浠ュ湪鑷畾涔夊璞′腑瀹炵幇NSCoding鍗忚,瑕佸疄鐜癗SCoding鍗忚,瀹炵幇涓や釜鏂规硶

3.SQLite3

SQLite鐨勬暟鎹簱鏉冮檺鍙緷璧栦簬鏂囦欢绯荤粺锛屾病鏈夌敤鎴峰笎鎴风殑姒傚康銆係QLite鏈夋暟鎹簱绾ч攣瀹氾紝娌℃湁缃戠粶鏈嶅姟鍣ㄣ�傚畠闇�瑕佺殑鍐呭瓨锛屽叾瀹冨紑閿�寰堝皬锛岄�傚悎鐢ㄤ簬宓屽叆寮忚澶囥�備綘闇�瑕佸仛鐨勪粎浠呮槸鎶婂畠姝g‘鐨勭紪璇戝埌浣犵殑绋嬪簭銆�

4.Core Data

Core Data鏈川涓婃槸浣跨敤SQLite淇濆瓨鏁版嵁锛屼絾鏄畠涓嶉渶瑕佺紪鍐欎换浣昐QL璇彞銆�

瑕佷娇鐢–ore Data锛岄渶瑕佸湪Xcode涓殑鏁版嵁妯″瀷缂栬緫鍣ㄤ腑璁捐濂藉悇涓疄浣撲互鍙婂畾涔夊ソ浠栦滑鐨勫睘鎬у拰鍏崇郴銆備箣鍚庯紝閫氳繃鎿嶄綔杩欎簺瀵硅薄锛岀粨鍚圕ore Data瀹屾垚鏁版嵁鐨勬寔涔呭寲锛�

132.缃戠粶閫氫俊鐢ㄨ繃鍝簺鏂瑰紡?

(闄勭綉鍧�:http://blog.csdn.net/chang6520/article/details/7967698)

鍚屾牱涔熸槸浠g爜瑙i噴

iOS璁惧鐨勭綉缁滈�氫俊鐨勬柟娉曪紝鏈夊涓嬩袱涓ぇ绫伙細

1銆佷娇鐢╯ocket鐨勬柟寮忚繘琛岄�氫俊銆�

浠CP涓哄埄锛屽浜嶵CP鏉ヨ锛屾槸瑕佸尯鍒嗘湇鍔$鍜屽鎴风鐨勩�傛湇鍔$锛氶�氬父鐨勬柟娉曟槸鏈嶅姟绔惎鍔ㄥ悗鐩戝惉锛屾槸鍚︽湁瀹㈡埛绔繛鎺ワ紝濡傛灉鏈夎繛鎺ワ紝鍒欏缓绔嬩笌瀹㈡埛绔殑閫氫俊銆傚鎴风鐨勬柟娉曢�氬父鏄繛鎺ユ湇鍔$锛屽綋杩炴帴鎴愬姛涔嬪悗锛屽氨甯屾湜鍙戦�佹暟鎹簡銆�

2銆佷娇鐢╝synsocket绫诲簱杩涜閫氫俊銆�

133.濡備綍澶勭悊澶氫釜缃戠粶璇锋眰骞跺彂鐨勬儏鍐�?

绛�:

(闄勭綉鍧�:http://www.cnblogs.com/yanhuaxuanlan/p/4683557.html)

绛旀閮芥槸浠g爜,澶у鍙互鎵撳紑缃戝潃浠旂粏闃呰

1.骞跺彂褰撴湁澶氫釜绾跨▼鍦ㄦ搷浣滄椂,濡傛灉绯荤粺鍙湁涓�涓狢PU,鍒欏畠鏍规湰涓嶅彲鑳界湡姝e悓鏃惰繘琛屼竴涓互涓婄殑绾跨▼锛屽畠鍙兘鎶奀PU杩愯鏃堕棿鍒掑垎鎴愯嫢骞蹭釜鏃堕棿娈�,鍐嶅皢鏃堕棿娈靛垎閰嶇粰鍚勪釜绾跨▼鎵ц锛屽湪涓�涓椂闂存鐨勭嚎绋嬩唬鐮佽繍琛屾椂锛屽叾瀹冪嚎绋嬪浜庢寕璧风姸銆�.杩欑鏂瑰紡鎴戜滑绉颁箣涓哄苟鍙�(Concurrent)銆�

2.骞惰褰撶郴缁熸湁涓�涓互涓奀PU鏃�,鍒欑嚎绋嬬殑鎿嶄綔鏈夊彲鑳介潪骞跺彂銆傚綋涓�涓狢PU鎵ц涓�涓嚎绋嬫椂锛屽彟涓�涓狢PU鍙互鎵ц鍙︿竴涓嚎绋嬶紝涓や釜绾跨▼浜掍笉鎶㈠崰CPU璧勬簮锛屽彲浠ュ悓鏃惰繘琛岋紝杩欑鏂瑰紡鎴戜滑绉颁箣涓哄苟琛�(Parallel)銆�

3.鍖哄埆骞跺彂鍜屽苟琛屾槸鍗崇浉浼煎張鏈夊尯鍒殑涓や釜姒傚康锛屽苟琛屾槸鎸囦袱涓垨鑰呭涓簨浠跺湪鍚屼竴鏃跺埢鍙戠敓锛涜�屽苟鍙戞槸鎸囦袱涓垨澶氫釜浜嬩欢鍦ㄥ悓涓�鏃堕棿闂撮殧鍐呭彂鐢熴��

134.绠�鍗曚粙缁嶄竴涓婯VC鍜孠VO,浠栦滑閮藉彲浠ュ簲鐢ㄥ湪鍝簺鍦烘櫙?

绛�:

(闄勭綉鍧�:http://blog.csdn.net/zhaozy55555/article/details/8598374

http://www.cnblogs.com/kenshincui/p/3871178.html)

KVC:NSKeyValueCoding鐨勭畝绉帮紝鏄竴绉嶅彲浠ョ洿鎺ラ�氳繃瀛楃涓茬殑鍚嶅瓧锛坘ey锛夋潵璁块棶绫诲睘鎬х殑鏈哄埗锛岃�屼笉鏄�氳繃璋冪敤鐨凷etter銆丟etter鏂规硶璁块棶銆�

KVC鐨勬搷浣滄柟娉曠敱NSKeyValueCoding鍗忚鎻愪緵锛孨SObject灏卞疄鐜颁簡杩欎釜鍗忚锛屼篃灏辨槸璇村鏋滃璞℃槸NSObject鐨勫瓙瀵硅薄閭d箞灏辨敮鎸並VC鎿嶄綔锛孠VC鏈変袱绉嶆搷浣滄柟娉曪紝涓�绉嶆槸璁惧�硷紝涓�绉嶆槸鍙栧�硷紝鍙互鐞嗚В涓篻etter鍜宻etter锛屼笉杩囩◢寰湁鎵�涓嶅悓鐨勬槸锛岃缃璞″�肩殑鏂规硶涓湁涓や釜锛宻etValue:灞炴�у�糵orKey:灞炴�у悕锛堜竴鑸殑璁剧疆锛屾瘮濡傝鏄璁剧疆NSString,NSNumber绛夊熀鏈被绫诲瀷锛宻etetValue:灞炴�у�糵orKeyPath:灞炴�ц矾寰�

2.KVO:NSKeyValueObserving鐨勭畝绉帮紝褰撴寚瀹氱殑瀵硅薄鐨勫睘鎬ц淇敼浜嗭紝鍏佽瀵硅薄鎺ュ彈鍒伴�氱煡鐨勬満鍒躲�傛瘡娆℃寚瀹氱殑琚瀵熷璞$殑灞炴�ц淇敼鐨勬椂鍊欙紝KVO閮戒細鑷姩鐨勫幓閫氱煡鐩稿簲鐨勮瀵熻�咃紝鐩稿綋浜庤璁℃ā寮忎腑鐨勮瀵熻�呮ā寮忋��

Key-Value Observing (KVO)寤虹珛鍦↘VC涔嬩笂锛岃兘澶熻瀵熶竴涓璞$殑KVC key path鍊肩殑鍙樺寲锛屾帴涓嬫潵鐨勫仛鐨勫疄渚嬫槸鍦╥OS涓鍥剧殑ViewDidLoad涓疄鐜扮殑锛岃窡KVC绫讳技锛屼笉杩囧彲浠ョ洃鍚�肩殑鍙樺寲锛屽疄鐜拌捣鏉ュ緢绠�鍗昦ddObserver娣诲姞瑙傚療锛宱bserveValueForKeyPath瑙傚療鍙樺寲涔嬪悗鐨勪簨浠讹紝鏈�鍚庨渶瑕侀攢姣佷互涓嬬洃鍚簨浠讹紝

135.瀹炵幇澶氱嚎绋嬫湁鍝簺鏂规硶,鍒嗗埆鏈変粈涔堝尯鍒�?

绛�: (http://www.cnblogs.com/hanjun/p/3667874.html)

1.NSThread

2.NSOperationQueue

3.GCD

鍖哄埆:

Thread鏄繖涓夌鑼冨紡閲岄潰鐩稿杞婚噺绾х殑锛屼絾涔熸槸浣跨敤璧锋潵鏈�璐熻矗鐨勶紝浣犻渶瑕佽嚜宸辩鐞唗hread鐨勭敓鍛藉懆鏈燂紝绾跨▼涔嬮棿鐨勫悓姝ャ�傜嚎绋嬪叡浜悓涓�搴旂敤绋嬪簭鐨勯儴鍒嗗唴瀛樼┖闂达紝瀹冧滑鎷ユ湁瀵规暟鎹浉鍚岀殑璁块棶鏉冮檺銆備綘寰楀崗璋冨涓嚎绋嬪鍚屼竴鏁版嵁鐨勮闂紝涓�鑸仛娉曟槸鍦ㄨ闂箣鍓嶅姞閿侊紝杩欎細瀵艰嚧涓�瀹氱殑鎬ц兘寮�閿�銆傚湪iOS涓垜浠彲浠ヤ娇鐢ㄥ绉嶅舰寮忕殑thread:

Cocoa threads:浣跨敤NSThread鎴栫洿鎺ヤ粠NSObject鐨勭被鏂规硶performSelectorInBackground:withObject:鏉ュ垱寤轰竴涓嚎绋嬨�傚鏋滀綘閫夋嫨thread鏉ュ疄鐜板绾跨▼锛岄偅涔圢SThread灏辨槸瀹樻柟鎺ㄨ崘浼樺厛閫夌敤鐨勬柟寮忋��

Cocoa operations鏄熀浜嶰bective-C瀹炵幇鐨勶紝绫籒SOperation浠ラ潰鍚戝璞$殑鏂瑰紡灏佽浜嗙敤鎴烽渶瑕佹墽琛岀殑鎿嶄綔锛屾垜浠彧瑕佽仛鐒︿簬鎴戜滑闇�瑕佸仛鐨勪簨鎯咃紝鑰屼笉蹇呭お鎿嶅績绾跨▼鐨勭鐞嗭紝鍚屾绛変簨鎯咃紝鍥犱负NSOperation宸茬粡涓烘垜浠皝瑁呬簡杩欎簺浜嬫儏銆侼SOperation鏄竴涓娊璞″熀绫伙紝鎴戜滑蹇呴』浣跨敤瀹冪殑瀛愮被銆俰OS鎻愪緵浜嗕袱绉嶉粯璁ゅ疄鐜帮細NSInvocationOperation鍜孨SBlockOperation銆�

Grand Central Dispatch (GCD): iOS4鎵嶅紑濮嬫敮鎸侊紝瀹冩彁渚涗簡涓�浜涙柊鐨勭壒鎬э紝浠ュ強杩愯搴撴潵鏀寔澶氭牳骞惰缂栫▼锛屽畠鐨勫叧娉ㄧ偣鏇撮珮锛氬浣曞湪澶氫釜cpu涓婃彁鍗囨晥鐜囥��

136.The ios/osx鈥檚 graphics is bassed onOpenGL . what is OpenGL?

iOS鐨�/ OS X鐨勫浘褰㈡槸鍩轰簬OpenGL銆備粈涔堟槸OpenGL锛�

(闄勭綉鍧�:https://developer.apple.com/opengl/)

瀹樻柟鐨勮В閲�:OpenGL鏄‖浠跺熀纭�鍥惧舰鍔犻�熷湪OS X鐨勬潈鍔涙牳蹇冨姩鐢伙紝鏍稿績褰㈣薄锛屽拰鐭宠嫳鐨勬瀬绔拰缁欎綘鐨勫簲鐢ㄧ▼搴忚闂儕浜虹殑3D鍥惧舰澶勭悊鑳藉姏銆備娇鐢ㄥ伐涓氭爣鍑嗙殑鍥惧舰API鍒涘缓涓�绯诲垪搴旂敤绋嬪簭锛屽寘鎷父鎴忥紝鍔ㄧ敾鍒朵綔杞欢锛屼互鍙婂尰鐤楁垚鍍忚В鍐虫柟妗堛��

鐧惧害鐨勮В閲�:

OpenGL:(Open Graphics Library)鏄寚瀹氫箟浜嗕竴涓法缂栫▼璇█銆佽法骞冲彴鐨勭紪绋嬫帴鍙h鏍肩殑涓撲笟鐨勫浘褰㈢▼搴忔帴鍙c�傚畠鐢ㄤ簬涓夌淮鍥惧儚锛堜簩缁寸殑浜﹀彲锛夛紝鏄竴涓姛鑳藉己澶э紝璋冪敤鏂逛究鐨勫簳灞傚浘褰㈠簱銆傝绠楁満涓夌淮鍥惧舰鏄寚灏嗙敤鏁版嵁鎻忚堪鐨勪笁缁寸┖闂撮�氳繃璁$畻杞崲鎴愪簩缁村浘鍍忓苟鏄剧ず鎴栨墦鍗板嚭鏉ョ殑鎶�鏈�侽penGL灏辨槸鏀寔杩欑杞崲鐨勭▼搴忓簱锛屽畠婧愪簬SGI鍏徃涓哄叾鍥惧舰宸ヤ綔绔欏紑鍙戠殑IRIS GL锛屽湪璺ㄥ钩鍙扮Щ妞嶈繃绋嬩腑鍙戝睍鎴愪负OpenGL銆侽penGL琚璁℃垚鐙珛浜庣‖浠躲�佺嫭绔嬩簬绐楀彛绯荤粺锛屽湪鍚勭鎿嶄綔绯荤粺鐨勮绠楁満涓婇兘鍙敤鐨勶紝骞惰兘鍦ㄧ綉缁滅幆澧冧笅浠ュ鎴�/鏈嶅姟鍣ㄦā寮忓伐浣滐紝鏄笓涓氬浘褰㈠鐞嗐�佺瀛﹁绠楃瓑楂樼搴旂敤棰嗗煙鐨勬爣鍑嗗浘褰㈠簱

137.What is CoreFoundation framework,andwhat is Foundation frame-work

浠�涔堟槸妗嗘灦鐨凜oreFoundation锛屼粈涔堟槸Foundation妗嗘灦

绛�:

(闄�:鏂囬《椤剁綉鍧�http://www.cnblogs.com/wendingding/p/3710820.html鍜�http://blog.csdn.net/annkey123/article/details/8271867)

Core Foundation妗嗘灦(CoreFoundation.framework)鏄竴缁凜璇█鎺ュ彛锛屽畠浠负iOS搴旂敤绋嬪簭鎻愪緵鍩烘湰鏁版嵁绠$悊鍜屾湇鍔″姛鑳姐��

Foundation鈥斿熀纭�妗嗘灦銆傛鏋朵腑鍖呭惈浜嗗緢澶氬紑鍙戜腑甯哥敤鐨勬暟鎹被鍨嬶紝濡傜粨鏋勪綋锛屾灇涓撅紝绫荤瓑锛屾槸鍏朵粬ios妗嗘灦鐨勫熀纭�銆�

濡傛灉瑕佹兂浣跨敤foundation妗嗘灦涓殑鏁版嵁绫诲瀷锛岄偅涔堝寘鍚畠鐨勪富澶存枃浠跺氨鍙互浜嗐��

鍗�#import

琛ュ厖锛歝ore foundation妗嗘灦鐩稿搴曞眰锛岄噷闈㈢殑浠g爜鍑犱箮閮芥槸c璇█鐨勶紝鑰宖oundation涓槸OC鐨勩��

138.How do you save data for you app

浣犲浣曚繚瀛樹綘鐨勫簲鐢ㄧ▼搴忔暟鎹�

绛�:

(闄勭綉鍧�:搴旂敤鏁版嵁瀛樺偍鏂瑰紡

锛圶ML灞炴�у垪琛�-plist锛�: http://www.cnblogs.com/ wendingding/p/3773867.html

(鍋忓ソ璁剧疆):http://www.cnblogs.com/wendingding/p/3775178.html

(褰掓。):http://www.cnblogs.com/wendingding/p/3775293.html)

ios搴旂敤鏁版嵁瀛樺偍鏂瑰紡锛圶ML灞炴�у垪琛�-plist锛塱os搴旂敤甯哥敤鐨勬暟鎹瓨鍌ㄦ柟寮�

1.plist锛圶ML灞炴�у垪琛ㄥ綊妗o級

2.鍋忓ソ璁剧疆

3.NSKeydeArchiver褰掓。锛堝瓨鍌ㄨ嚜瀹氫箟瀵硅薄锛�

4.SQLite3(鏁版嵁搴擄紝鍏崇郴鍨嬫暟鎹簱锛屼笉鑳界洿鎺ュ瓨鍌ㄥ璞★紝瑕佺紪鍐欎竴浜涙暟鎹簱鐨勮鍙ワ紝灏嗗璞℃媶寮�瀛樺偍)

5.Core Data锛堝璞″瀷鐨勬暟鎹簱锛屾妸鍐呴儴鐜妭灞忚斀锛�

139.Do you use GIT version control?What isthe difference between merge and rebase ? If you are not using GIT ,are youusing any distributed version control system?

鎮ㄦ槸鍚︿娇鐢℅it鐗堟湰鎺у埗锛熶粈涔堟槸鍚堝苟鍜岄噸璁箣闂寸殑鍖哄埆锛熷鏋滀綘娌℃湁浣跨敤Git锛屾偍浣跨敤鐨勫垎甯冨紡鐗堟湰鎺у埗绯荤粺锛�

绛�:寤鸿澶у浣跨敤鐧惧害缈昏瘧鎵撳紑缃戝潃浠ヤ笅鍧囨槸鑻辨枃瑙i噴

(闄勭綉鍧�:浠�涔堟槸鐗堟湰鎺у埗:https://git-scm.com/book/zh/ch1-1.html

鍥藉缃戝弸鐨勮В閲�:http://translate.baiducontent.com/transpage?query=http%3A%2F%2Fserve.3ezy.com%2Fstackoverflow.com%2Fquestions%2F16666089%2Fwhats-the-difference-between-git-merge-and-git-rebase&from=en&to=zh&source=url

鍚堣鍜岄噸瀹氱殑瑙i噴:http://translate.baiducontent.com/transpage?cb=translateCallback&ie=utf8&source=url&query=http%3A%2F%2Fserve.3ezy.com%2Fgit-scm.com%2Fbook%2Fen%2FGit-Branching-Rebasing&from=en&to=zh&token=&monLang=zh

瑙嗛鐨勭綉鍧�:http://www.git-tower.com/learn/git/videos/)

140.Storyboard or Xib, which do youprefer?And why

Storyboard鍜孹ib浣犲枩娆㈠摢涓负浠�涔�?

绛�:

(闄勭綉鍧�:http://blog.mobilejazz.com/storyboards-xibs-best-practices/)

鍠滄鍝釜澶у鍙互閫夋嫨:浠ヤ笅鏄疭toryboard鍜孹ib鐨勪紭缂虹偣鍙互鍙傝�冧互涓�

浠ヤ笅瑙i噴鏄嫳鏂囩炕璇戣繃鏉ョ殑(寤鸿澶у鍙互鐪嬬綉鍧�鍘熸枃绔�)

xibs鏄疿ML鏂囦欢瀹氫箟鍜岄厤缃殑涓�缁勫璞★紝骞朵笓闂ㄦ搷绾典富瑕佽鐐癸紙UIView瀛愮被锛夈�俋code鍏锋湁鍙嬪ソ鐨勭紪杈戝櫒锛屽彲浠ユ樉绀鸿繖浜涙剰瑙侊紝瀹冩槸涓�涓繍琛岀殑搴旂敤绋嬪簭锛屼娇寰楀畠鐨勯厤缃拰璁捐甯冨眬闈炲父瀹规槗锛堣妭鐪佸緢澶氳浠g爜锛夈��

鍗充娇澶у鏁板紑鍙戝晢鍏宠仈涓�涓獂ib鏂囦欢鈥滃睆骞曗�濇垨鈥滆鍥炬帶鍒跺櫒鈥濓紝鏄�氱敤鐨勫鍣▁ibs瀵硅薄鍜屽彲浠ヤ竴璧蜂娇鐢紝涓庡叾瀹冪被鍨嬬殑瀵硅薄浣滀负nsobjects UIViews锛屾垨鑰呭彧鏄竴涓汉銆�

Storyboard

杩欐槸涓�涓猉ML鏂囦欢浠h〃缁熶竴涓�濂梮ibs涓轰簡瀹氫箟瀵艰埅涔嬮棿鐨勪竴缁勮鍥炬帶鍒跺櫒銆傛湁涓�涓晠浜嬩竴涓紑鍙戣�呭彲浠ュ畾涔夊涓�滃睆骞曗�濓紙鎴栧拰瀵艰埅涔嬮棿鐨�UIViewController绫伙級浠栦滑銆�

浣滀负涓�涓樊鐨刋IB锛屾晠浜嬫槸鐢卞畾涔夌殑瑙嗗浘鍜屽鑸�澶勭悊浠栦滑涔嬮棿銆�

xibs VS浠g爜鐨勫ソ澶�

瑙嗗浘鐨勫彲瑙嗗寲閰嶇疆銆�

鑷姩甯冨眬鐨勮瑙夊舰鎬併��

澶у皬鐝殑瑙嗚褰㈡�併��

鑺傜渷鏃堕棿鍜屼唬鐮侊紝鑰屸�滃垱寤哄疄渚嬧�濄��

鑺傜渷鏃堕棿鍜屼唬鐮侊紝鑰屸�滈厤缃璞♀�濄��

蹇��UITableViewCell鍘熷瀷銆�

蹇�熼厤缃帶鍒跺姩浣滐紙ibactions锛夈��

Storyboard涓巟ibs鏁堢泭

鍙互鐩存帴鍦ㄨ剼鏈湰韬師鍨�鐨勮銆�

鍙互瀹氫箟闈欐��琛ㄦ牸閮ㄥ垎鍜岃銆�

鍙互浣跨敤鑷姩甯冨眬绾︽潫娣诲姞鍒�toplayoutguide鍜�bottomlayoutguide銆�

鍙互鎸囧畾瀵艰埅鍜岃繃娓★紙杩欐槸涓�涓富瑕佺殑鐩殑锛侊級銆�

鍙互瀹氫箟澶氫釜鈥滃睆骞曗�濓紙澶勭悊鐨勶級鍦ㄤ竴涓湴鏂癸紙涓嶉渶瑕佸xibs锛夈��

瀵箈ibs VS浠g爜涓嶄究

瀹规槗鐮磋鍚堝苟鏃讹紙GIT锛夈��

涓嶅鏉傜殑鑷姩甯冨眬瀹氫箟銆�

涓嶈兘寮曠敤锛堟垨鍖呮嫭锛夊叾浠杧ibs銆�

Storyboard涓庝唬鐮亁ibs涓嶄究

鏁呬簨鎯呰妭鏄細澶ф枃浠剁殑鍔犺浇閫熷害鎱紝鏈夋椂銆�

闇�瑕佷竴涓ぇ灞忓箷鏄剧ず鎵�鏈夛紙鎴栭儴鍒嗭級鐨勫唴瀹广��

瀹规槗鐮磋鍚堝苟鏃讹紙GIT锛夈��

楂樻鐜囨墦鐮村畠鏃讹紝鍚堝苟锛圙IT锛変綔涓烘晠浜嬪寘鍚緢澶氫俊鎭��

璁稿璀﹀憡褰撴敮鎸乮OS 7鍜宨OS 8锛堝埄娑︼紝澶у皬鐝級銆�

涓嶈兘寮曠敤锛堟垨鍖呮嫭锛夊叾浠杧ibs銆�

151. Aside from regular tasks like

reading/writing element, getting the count of an array, can you write something

else you can do to an NSArray with only the built-in SDK? E.g, how do you

filter锛堣繃婊ゅ櫒锛�, map, an NSArray?

涓嶄細

152.Do you use SDWebImage? If yes, why doyou choose this library? If no, how do you load an image from Internet to anUIImageView?

缈昏瘧:浣犱娇鐢⊿DWebImage鍚楋紵濡傛灉浣跨敤锛屼綘涓轰粈涔堜娇鐢ㄨ繖涓簱锛屽鏋滀笉浣跨敤锛屼綘鏄�庢牱鍔犺浇涓�寮犵綉缁滃浘鐗囩殑锛�

绛旀锛氳繖涓被搴撴彁渚涗竴涓猆IImageView绫诲埆浠ユ敮鎸佸姞杞芥潵鑷綉缁滅殑杩滅▼鍥剧墖銆傚叿鏈夌紦瀛樼鐞嗐�佸紓姝ヤ笅杞姐�佸悓涓�涓猆RL涓嬭浇娆℃暟鎺у埗鍜屼紭鍖栫瓑鐗瑰緛銆�

156.鐪嬩笅闈㈢殑绋嬪簭,绗竴涓狽SLog浼氳緭鍑轰粈涔�?杩欐椂str鐨剅etainCount鏄灏�?绗簩涓拰绗笁涓憿?涓轰粈涔�

NSMutableArray* ary = [[NSMutableArrayarray] retain]; //2

NSString *str = [NSStringstringWithFormat:@"test"];//1

[str retain];// 2

[ary addObject:str]; // 3

NSLog(@"%d", [str retainCount]);

[str retain];// 4

[str release];// 3

[str release];// 2

NSLog(@"%d", [str retainCount]);//2

[ary removeAllObjects]; // 1

NSLog(@"%d", [strretainCount]);

缁撴灉锛�3銆�2銆�1

157.Storyboard or Xib, which do you

prefer?And why锛�

浣犲枩娆娇鐢⊿toryboard杩樻槸Xib?涓轰粈涔堬紵

璇︾粏瑙i噴锛氣�渉ttp://stackoverflow.com/questions/13834999/storyboards-vs-the-old-xib-way鈥�

绛旀: The reasons for liking Storyboard:There are things you can do with

a storyboard that you can't do with a nib. A storyboard lets you create segues

between view controllers, and it lets you design table view cells in-place. One

big advantage of Storyboard is the ability to view your entire application's

GUI锛堝浘褰㈢敤鎴风晫闈級flow. Zoom out and you can see how everything interconnects andflows.

The reasons for liking Xib : There are

things you can do with a nib that you can't do with a storyboard. In a nib, you

can create references to the File's Owner placeholder锛堝崰浣嶇锛�. You

can create multiple top-level views, edit them, and create connections between

them. See this answer for an example of why you'd want to do that. You can add

external锛堝閮ㄧ殑锛塷bject placeholders (a rarely-used feature寰堝皯浣跨敤鐨勫姛鑳�).

1.Apartfrom the historical value in the xib approach, xib's also provide modularity.Perhaps you have a library of code or wish to share a useful widget you made.Taking the xib approach would facilitate that sharing and reuse.

2.Thexib approach also allows you some greater flexibility in terms of your owncode.

3.Withxibs, while the modularity is nice, it's tougher to envision how everythingconnects and flows together. This can be a useful feature for yourself, or ifyou have a larger team to share with, to allow others to see how the app flows.

158. if you鈥檝e started using Swift,writedown one or two features that is presenting Swift which is not Objective-C, andhow it helps you

鑻辫缈昏瘧锛氬鏋滀綘宸茬粡浣跨敤浜哠wift,鍐欏嚭涓�涓垨涓や釜Swift鏈夎�孫C娌℃湁鐨勫姛鑳斤紝瀹冩槸鎬庢牱甯姪浣犵殑锛�

绛旀锛氬彲閫夌被鍨嬶紙optionals锛夈�佸厓缁勶紙tuples锛夈�佹硾鍨嬶紙generics锛夛紝绫诲瀷鎺ㄦ柇锛坱ype inference锛変互鍙婂叾浠栫瓑绛夈�傦紙绛旀涓嶅叏锛�

159. How do you do abackground task锛堝悗鍙颁换鍔★級in iOS,indifferent ways ? And which one doyou prefer

缈昏瘧锛氫綘鎬庢牱鐢ㄤ竴绉嶄笉鍚岀殑鏂瑰紡鍋氫竴涓悗鍙颁换鍔★紝浣犲枩娆㈠摢涓�绉嶆柟寮忥紵

绛旀锛歨ttp://www.2cto.com/kf/201402/278626.html

160.static鍏抽敭瀛楃殑浣滅敤?

鍦–璇█涓紝鍏抽敭瀛梥tatic鏈変笁涓槑鏄剧殑浣滅敤锛�

1).鍦ㄥ嚱鏁颁綋锛屼竴涓澹版槑涓洪潤鎬佺殑鍙橀噺鍦ㄨ繖涓�鍑芥暟琚皟鐢ㄨ繃绋嬩腑缁存寔鍏跺�间笉鍙樸��

2).鍦ㄦā鍧楀唴锛堜絾鍦ㄥ嚱鏁颁綋澶栵級锛屼竴涓澹版槑涓洪潤鎬佺殑鍙橀噺鍙互琚ā鍧楀唴鎵�鐢ㄥ嚱鏁拌闂紝浣嗕笉鑳借妯″潡澶栧叾瀹冨嚱鏁拌闂�傚畠鏄竴涓湰鍦扮殑鍏ㄥ眬鍙橀噺銆�

3).鍦ㄦā鍧楀唴锛屼竴涓澹版槑涓洪潤鎬佺殑鍑芥暟鍙彲琚繖涓�妯″潡鍐呯殑鍏跺畠鍑芥暟璋冪敤銆傞偅灏辨槸锛岃繖涓嚱鏁拌闄愬埗鍦ㄥ0鏄庡畠鐨勬ā鍧楃殑鏈湴鑼冨洿鍐呬娇鐢ㄣ��

161.鍫嗗拰鏍堢殑鍖哄埆?

鍫嗗拰鏍堢殑鍖哄埆锛�

涓�銆佸爢鏍堢┖闂村垎閰嶅尯鍒細

1銆佹爤锛堟搷浣滅郴缁燂級锛氱敱鎿嶄綔绯荤粺鑷姩鍒嗛厤閲婃斁锛屽瓨鏀惧嚱鏁扮殑鍙傛暟鍊硷紝灞�閮ㄥ彉閲忕殑鍊肩瓑銆傚叾鎿嶄綔鏂瑰紡绫讳技浜庢暟鎹粨鏋勪腑鐨勬爤锛�

2銆佸爢锛堟搷浣滅郴缁燂級锛氫竴鑸敱绋嬪簭鍛樺垎閰嶉噴鏀撅紝鑻ョ▼搴忓憳涓嶉噴鏀撅紝绋嬪簭缁撴潫鏃跺彲鑳界敱OS鍥炴敹锛屽垎閰嶆柟寮忓�掓槸绫讳技浜庨摼琛ㄣ��

浜屻�佸爢鏍堢紦瀛樻柟寮忓尯鍒細

1銆佹爤浣跨敤鐨勬槸涓�绾х紦瀛橈紝浠栦滑閫氬父閮芥槸琚皟鐢ㄦ椂澶勪簬瀛樺偍绌洪棿涓紝璋冪敤瀹屾瘯绔嬪嵆閲婃斁锛�

2銆佸爢鏄瓨鏀惧湪浜岀骇缂撳瓨涓紝鐢熷懡鍛ㄦ湡鐢辫櫄鎷熸満鐨勫瀮鍦惧洖鏀剁畻娉曟潵鍐冲畾锛堝苟涓嶆槸涓�鏃︽垚涓哄鍎垮璞″氨鑳借鍥炴敹锛夈�傛墍浠ヨ皟鐢ㄨ繖浜涘璞$殑閫熷害瑕佺浉瀵规潵寰椾綆涓�浜涖��

涓夈�佸爢鏍堟暟鎹粨鏋勫尯鍒細

鍫嗭紙鏁版嵁缁撴瀯锛夛細鍫嗗彲浠ヨ鐪嬫垚鏄竴妫垫爲锛屽锛氬爢鎺掑簭锛�

鏍堬紙鏁版嵁缁撴瀯锛夛細涓�绉嶅厛杩涘悗鍑虹殑鏁版嵁缁撴瀯銆�

162.鐩爣~鍔ㄤ綔鏈哄埗

鐩爣鏄姩浣滄秷鎭殑鎺ユ敹鑰呫�備竴涓帶浠讹紝鎴栬�呮洿涓哄父瑙佺殑鏄畠鐨勫崟鍏冿紝浠ユ彃搴у彉閲忥紙鍙傝"鎻掑骇鍙橀噺"閮ㄥ垎锛�

鐨勫舰寮忎繚鏈夊叾鍔ㄤ綔娑堟伅鐨勭洰鏍囥��

鍔ㄤ綔鏄帶浠跺彂閫佺粰鐩爣鐨勬秷鎭紝鎴栬�呬粠鐩爣鐨勮搴︾湅锛屽畠鏄洰鏍囦负浜嗗搷搴斿姩浣滆�屽疄鐜扮殑鏂规硶銆�

绋嬪簭闇�瑕佹煇浜涙満鍒舵潵杩涜浜嬩欢鍜屾寚浠ょ殑缈昏瘧銆傝繖涓満鍒跺氨鏄洰鏍�-鍔ㄤ綔鏈哄埗

163.鑷姩閲婃斁姹犳槸浠�涔�,濡備綍宸ヤ綔?

涓�銆佷粈涔堟槸鑷姩閲婃斁姹�

1銆丄utorelease pool

鑷姩閲婃斁姹狅紙Autorelease pool锛夋槸OC鐨勪竴绉嶅唴瀛樿嚜鍔ㄥ洖鏀舵満鍒讹紝鍙互灏嗕竴浜涗复鏃跺彉閲忛�氳繃鑷姩閲婃斁姹犳潵鍥炴敹缁熶竴閲婃斁

鑷姩閲婃斁姹犳湰浜嬮攢姣佺殑鏃跺�欙紝姹犲瓙閲岄潰鎵�鏈夌殑瀵硅薄閮戒細鍋氫竴娆elease鎿嶄綔

2銆乤utorelease

浠讳綍OC瀵硅薄鍙璋冪敤autorelease鏂规硶锛屽氨浼氭妸璇ュ璞℃斁鍒扮鑷繁鏈�杩戠殑鑷姩閲婃斁姹犱腑锛堟爤椤剁殑閲婃斁姹狅級銆�

浜岋細O-C褰撲腑鐨勫唴瀛橀噴鏀撅紝骞朵笉鏄儚java/.net閭f牱鏈変竴涓嚜鍔ㄧ殑閲婃斁姹狅紝寮�鍙戜汉鍛樹笉鐢ㄥ幓鍏冲績鏈夊叧鍐呭瓨閲婃斁鐨勯棶棰橈紝O-C閲岄潰鐨勮嚜鍔ㄩ噴鏀炬睜姣攃璇█鐨勬墜鍔ㄥ唴瀛樼鐞嗚濂戒竴浜涳紝浣嗘槸鐩稿浜巎ava/.net鏉ヨ鍙堝急涓�浜涳紝鎵�浠ヨO-C褰撲腑鐨勯噴鏀惧睘浜庡崐鑷姩鐨勯噴鏀炬睜銆�

涓夈�佸浣曞垱寤轰竴涓嚜鍔ㄩ噴鏀炬睜

//ios5.0鏂版柟寮�

@autoreleasepool

{

}

//ios5.0涔嬪墠鐨勮�佹柟寮�

NSAutoreleasePool *pool=[[NSAutoreleasePoolalloc]init];

[pool release];

鍥涖�佽嚜鍔ㄩ噴鏀炬睜濡備綍閲婃斁瀵硅薄鍐呭瓨

榛勯噾娉曞垯锛氬鏋滃涓�涓璞′娇鐢ㄤ簡alloc,[mutable]copy,retain,閭d箞蹇呴』浣跨敤鐩稿簲鐨剅elease鎴栬�卆utorelease.

164.obj-c鐨勪紭鐐�

objc浼樼偣锛�

1) Cateogies

2) Posing

3)鍔ㄦ�佽瘑鍒�

4)鎸囨爣璁$畻

5锛夊脊鎬ц鎭紶閫�

6)涓嶆槸涓�涓繃搴﹀鏉傜殑C琛嶇敓璇█

7) Objective-C涓嶤++鍙贩鍚堢紪绋�

缂虹偣:

1)涓嶆敮鎻村懡鍚嶇┖闂�

2)涓嶆敮鎸佽繍绠楃閲嶈浇

3锛変笉鏀寔澶氶噸缁ф壙

4锛変娇鐢ㄥ姩鎬佽繍琛屾椂绫诲瀷锛屾墍鏈夌殑鏂规硶閮芥槸鍑芥暟璋冪敤锛屾墍浠ュ緢澶氱紪璇戞椂浼樺寲鏂规硶閮界敤涓嶅埌銆傦紙濡傚唴鑱斿嚱鏁扮瓑锛夛紝鎬ц兘浣庡姡銆�

OC娌℃湁澶氶噸缁ф壙锛孞ava涔熸病鏈塁++鎵嶆湁

OC浣跨敤鍗忚鏉ュ疄鐜板閲嶇户鎵�

165.浠�涔堟椂鍊欑敤delegate,浠�涔堟椂鍊欑敤Notification

1.鍙傛暟鐨勪笉鍚�

浣跨敤delegate鍙傛暟鏇村姞鐩磋锛屼娇鐢╪otification鍙傛暟涓嶉偅涔堢洿瑙傦紝鎵�浠ヨ兘浣跨敤delegate鐨勫湴鏂癸紝灏介噺浣跨敤delegate

2.浼犻�掔殑闀垮害

鏈夋椂鍊欎綘鐨勯〉闈細涓�娆¤烦濂藉嚑涓〉闈紝閭d箞浣犳兂鎶婅繖涓〉闈㈢殑鏁版嵁浼犲洖鍒板簳灞傛槸寰堥夯鐑︾殑浜嬫儏锛屽洜涓轰綘瑕佹妸delegate鎸囬拡浠庡簳灞傜晫闈竴鐩翠紶涓婃潵銆�

3.浼犻�掑涓暟鎹�

褰撲綘鍦ㄥ悓涓�涓璞′紶閫掔粰澶氫釜瀵硅薄锛岀敤delegate灏变笉鍙浜嗐��

166.浠�涔堟槸KVC鍜孠VO?

1銆並VC锛屽嵆鏄寚NSKeyValueCoding锛屼竴涓潪姝e紡鐨凱rotocol锛屾彁渚涗竴绉嶆満鍒舵潵闂存帴璁块棶瀵硅薄鐨勫睘鎬с�傝�屼笉鏄�氳繃璋冪敤Setter銆丟etter鏂规硶璁块棶銆侹VO灏辨槸鍩轰簬KVC瀹炵幇鐨勫叧閿妧鏈箣涓�銆�

2銆並VO鐨勬槸KeyValue

Observe鐨勭缉鍐欙紝涓枃鏄敭鍊艰瀵熴�傝繖鏄竴涓吀鍨嬬殑瑙傚療鑰呮ā寮忥紝瑙傚療鑰呭湪閿�兼敼鍙樻椂浼氬緱鍒伴�氱煡銆俰OS涓湁涓狽otification鐨勬満鍒讹紝涔熷彲浠ヨ幏寰楅�氱煡锛屼絾杩欎釜鏈哄埗闇�瑕佹湁涓狢enter锛岀浉姣斾箣涓婯VO鏇村姞绠�娲佽�岀洿鎺ャ��

167.绫诲埆鐨勪綔鐢�

浣滅敤锛�

1瀵圭郴缁熺殑绫绘垨鑷繁瀹氫箟鐨勭被鐨勬墿鍏咃紙鍙槸鎸囷紝涓嶈兘澹版槑灞炴�nstance variable锛塭.g. base64 MD5.浣嗘槸涓嶈兘淇濊瘉鎵�鏈夌殑鏂规硶閮借兘琚皟鐢ㄣ�傚挨鍏舵槸鍦ㄦ寚瀹氫竴涓笌绯荤粺鐨勬柟娉曠浉鍚岀殑鏂规硶鏃朵竴瀹氳娉ㄦ剰銆�

鏂囦欢鍚嶏細NSString+additions.h

NSString+additions.m

@interface NSString (Base64)

2鍙互澹版槑绉佹湁鏂规硶銆�

ZYViewController.m

@interfaceZYViewController (additions)

//{

//BOOL isOK;

//}

- (void)ok;

@property

@end

3鍙互澹版槑鍒嗘暎绫荤殑鏂规硶锛圢SIndexPath锛�

鍒嗘暎绫讳綋鐜板嚭绫诲埆涓嶄粎鍙互鎵╁厖绯荤粺鐨勬柟娉曪紝鑰屼笖鍙互鎵╁厖鑷繁瀹氫箟鐨勭被銆�

鐢辩3涓綔鐢ㄥ彲鐭ワ細涓嶇鏄惁浣跨敤鐨勫垎鏁g被鍦ㄤ换浣曠殑.h鏂囦欢涓紝鎴戝彧鑰冭檻绫诲埆涓殑鏂规硶鍖呰9鍦ˊinterface className ..@end,閭d箞鎴戝彧鏄庣‘灏嗘潵绫诲埆涓殑鏂规硶灏卞睘浜巆lassName杩欎釜绫汇��

168.娴呭鍒跺拰娣卞鍒剁殑鍖哄埆

绠�鍗曠殑鏉ヨ灏辨槸锛屽湪鏈夋寚閽堢殑鎯呭喌涓嬶紝娴呮嫹璐濆彧鏄鍔犱簡涓�涓寚閽堟寚鍚戝凡缁忓瓨鍦ㄧ殑鍐呭瓨锛岃�屾繁鎷疯礉灏辨槸澧炲姞涓�涓寚閽堝苟涓旂敵璇蜂竴涓柊鐨勫唴瀛橈紝浣胯繖涓鍔犵殑鎸囬拡鎸囧悜杩欎釜鏂扮殑鍐呭瓨锛岄噰鐢ㄦ繁鎷疯礉鐨勬儏鍐典笅锛岄噴鏀惧唴瀛樼殑鏃跺�欏氨涓嶄細鍑虹幇鍦ㄦ祬鎷疯礉鏃堕噸澶嶉噴鏀惧悓涓�鍐呭瓨鐨勯敊璇紒

鎴戝垪涓句竴涓緥瀛愭潵璇村惂锛�

浣犳鍦ㄧ紪鍐機++绋嬪簭涓湁鏃剁敤鍒帮紝鎿嶄綔绗︾殑閲嶈浇銆傛渶鑳戒綋鐜版繁灞傛嫹璐濅笌娴呭眰鎷疯礉鐨勶紝灏辨槸鈥�=鈥欑殑閲嶈浇銆�

鐪嬩笅闈竴涓畝鍗曠殑绋嬪簭锛�

class string{

char *m_str;

public:

string(char *s锛墈

m_str=s;

}

string()

{};

String & operator=(const string s){

m_str=s.m_str;

return *this

}

};

int main(){

string s1("abc"),s2;

s2=s1;

cout<

涓婇潰鐨�=閲嶈浇鍏舵槸灏辨槸瀹炵幇浜嗘祬鎷疯礉鍘熷洜銆傛槸鐢变簬瀵硅薄涔嬩腑鍚湁鎸囬拡鏁版嵁绫诲瀷.s1,s2鎭板ソ鎸囧悜鍚屼竴鍚勫唴瀛樸�傛墍浠ユ槸娴呮嫹璐濄�傝�屼綘濡傛灉淇敼涓�涓嬪師鏉ョ殑绋嬪簭锛�

string&operator=(const string&s){

if(strlen(m_str)!=strlen(s.m_str))

m_str=new char[strlen(s.m_str)+1];

if(*this!=s)

strcopy(m_str,s.m_str);

return *this;

}

杩欐牱浣犲氨瀹炵幇浜嗘繁鎷疯礉锛屽師鍥犳槸浣犱负琚祴鍊煎璞$敵璇蜂簡涓�涓柊鐨勫唴瀛樻墍浠ュ氨鏄繁鎷疯礉銆�

169.浠g悊鐨勪綔鐢�

浠g悊鐨勭洰鐨勬槸鏀瑰彉鎴栦紶閫掓帶鍒堕摼銆傚厑璁镐竴涓被鍦ㄦ煇浜涚壒瀹氭椂鍒婚�氱煡鍒板叾浠栫被锛岃�屼笉闇�瑕佽幏鍙栧埌閭d簺绫荤殑鎸囬拡銆傚彲浠ュ噺灏戞鏋跺鏉傚害銆�

鍙﹀涓�鐐癸紝浠g悊鍙互鐞嗚В涓簀ava涓殑鍥炶皟鐩戝惉鏈哄埗鐨勪竴绉嶇被浼笺��

170.鎴戜滑璇寸殑OC鏄姩鎬佽繍琛屾椂璇█鏄粈涔堟剰鎬�?

澶氭�併��

涓昏鏄皢鏁版嵁绫诲瀷鐨勭‘瀹氱敱缂栬瘧鏃讹紝鎺ㄨ繜鍒颁簡杩愯鏃躲��

杩欎釜闂鍏跺疄娴呮秹鍙婂埌涓や釜姒傚康锛岃繍琛屾椂鍜屽鎬併��

绠�鍗曟潵璇达紝杩愯鏃舵満鍒朵娇鎴戜滑鐩村埌杩愯鏃舵墠鍘诲喅瀹氫竴涓璞$殑绫诲埆锛屼互鍙婅皟鐢ㄨ绫诲埆瀵硅薄鎸囧畾鏂规硶銆傚鎬侊細涓嶅悓瀵硅薄浠ヨ嚜宸辩殑鏂瑰紡鍝嶅簲鐩稿悓鐨勬秷鎭殑鑳藉姏鍙仛澶氭�併��

鎰忔�濆氨鏄亣璁剧敓鐗╃被锛坙ife锛夐兘鐢ㄦ湁涓�涓浉鍚岀殑鏂规硶-eat;閭d汉绫诲睘浜庣敓鐗╋紝鐚篃灞炰簬鐢熺墿锛岄兘缁ф壙浜唋ife鍚庯紝瀹炵幇鍚勮嚜鐨別at锛屼絾鏄皟鐢ㄦ槸鎴戜滑鍙渶璋冪敤鍚勮嚜鐨別at鏂规硶銆�

涔熷氨鏄笉鍚岀殑瀵硅薄浠ヨ嚜宸辩殑鏂瑰紡鍝嶅簲浜嗙浉鍚岀殑娑堟伅锛堝搷搴斾簡eat杩欎釜閫夋嫨鍣級銆�

鍥犳涔熷彲浠ヨ锛岃繍琛屾椂鏈哄埗鏄鎬佺殑鍩虹銆�

171.浠�涔堟槸ARC锛熻绠�杩颁竴涓婣RC鐨勫師鐞嗐��

1锛堿RC鏄痠OS 5鎺ㄥ嚭鐨勬柊鍔熻兘锛屽叏绉板彨ARC(Automatic Reference Counting)銆傜畝鍗曞湴璇达紝灏辨槸浠g爜涓嚜鍔ㄥ姞鍏ヤ簡retain/release锛屽師鍏堥渶瑕佹墜鍔ㄦ坊鍔犵殑鐢ㄦ潵澶勭悊鍐呭瓨绠$悊鐨勫紩鐢ㄨ鏁扮殑浠g爜鍙互鑷姩鍦扮敱缂栬瘧鍣ㄥ畬鎴愪簡

2锛夈�丄RC鐨勮鍒欏氨鏄彧瑕佸璞℃病鏈夊己鎸囬拡寮曠敤锛屽氨浼氳閲婃斁鎺夛紝鎹㈣�岃█涔嬪彧瑕佽繕鏈変竴涓己寮曠敤鎸囬拡鍙橀噺鎸囧悜瀵硅薄锛岄偅涔堣繖涓璞″氨浼氬瓨鍦ㄥ唴瀛樹腑銆傚急鎸囬拡鎸囧悜鐨勫璞★紝浼氳鑷姩鍙樻垚绌烘寚閽堬紙nil鎸囬拡锛夛紝浠庤�屼笉浼氬紩鍙戦噹鎸囬拡閿欒銆�

172.绠�杩拌鍥炬帶鍒跺櫒鐨勭敓鍛藉懆鏈熴��

1锛夈�乮nit鍑芥暟(init;initWithFrame;initWithCoder;绛�)锛嶏紞鍒濆鍖�

2锛夈�乤wakeFromNib锛嶏紞鍦╨oadView涔嬪墠鐨勫伐浣滄斁鍦ㄨ繖閲�

3锛夈�乿iewDidLoad锛嶏紞娉ㄦ剰锛屼竴涓猇iewController涓�涓敓鍛藉懆鏈熷唴杩欎釜鍑芥暟鍙細璋冪敤涓�娆�

4锛夈�乿iewWillAppear锛嶏紞view灏嗚鍑虹幇锛屾瘡娆iew娑堝け鍐嶅嚭鐜伴兘浼氳皟鐢�

5锛夈�乿iewWillLayoutSubviews锛嶏紞绠�瑕佸瀛愯瘯鍥捐繘琛屽竷灞�

6锛夈�乿iewDidLayoutSubivews锛嶏紞瀹屾垚瀵瑰瓙璇曞浘甯冨眬

7锛夈�乿iewDidAppear锛嶏紞瑙嗗浘灏嗚鍑虹幇鍦ㄥ睆骞曚笂

锛嶏紞锛嶄笂杩颁唬鐮佷笉鍚儴鍒�

8锛夈�乿iewWillDisappear锛嶏紞View灏嗚娑堝け

9锛塿iewDidDisappear锛嶏紞View宸茬粡娑堝け

173.璇锋弿杩颁竴涓嬬嚎绋嬬殑鐢熷懡鍛ㄦ湡銆�

鏂板缓锛坣ew Thread锛夈�佸氨缁紙runnable锛夈�佽繍琛岋紙running锛夈�佹浜★紙dead锛夈�佸牭濉烇紙blocked锛�

174.璇疯嚦灏戝垪涓�5涓父鐢ㄧ殑璁捐妯″紡銆�

1锛夈�佷唬鐞嗘ā寮�2锛夈�佽瀵熻�呮ā寮�3锛夈�丮VC妯″紡4锛夈�佸崟渚嬫ā寮�5锛夊伐鍘傛ā寮�

175.濡備綍澧炲己iOS搴旂敤绋嬪簭鐨勬�ц兘銆�

鍒濈骇

1銆佷娇鐢ˋRC杩涜鍐呭瓨绠$悊銆�2.鍦ㄩ�傚綋鐨勬儏鍐典笅浣跨敤reuseIdentifier

3.灏藉彲鑳藉皢View璁剧疆涓轰笉閫忔槑锛圤paque锛�4.閬垮厤鑷冭偪鐨刋IBs 5.涓嶈闃诲涓荤嚎绋�6.璁╁浘鐗囩殑澶у皬璺烾IImageView涓�鏍�7.閫夋嫨姝g‘鐨勯泦鍚�8.浣跨敤GZIP鍘嬬缉

涓骇锛�

9.閲嶇敤鍜屽欢杩熷姞杞絍iew 10.缂撳瓨銆佺紦瀛樸�佺紦瀛�11.鑰冭檻缁樺埗12.澶勭悊鍐呭瓨璀﹀憡13.閲嶇敤鑺遍攢寰堝ぇ鐨勫璞�14.浣跨敤Sprite

Sheets 15.閬垮厤閲嶆柊澶勭悊鏁版嵁16.閫夋嫨姝g‘鐨勬暟鎹牸寮�17.璁剧疆閫傚綋鐨勮儗鏅浘鐗�18.闄嶄綆Web鍐呭鐨勫奖鍝�19.璁剧疆闃村奖璺緞20.浼樺寲TableView 21.閫夋嫨姝g‘鐨勬暟鎹瓨鍌ㄦ柟寮�

楂樼骇

22.鍔犻�熷惎鍔ㄦ椂闂�23.浣跨敤Autorelease

Pool 24.缂撳瓨鍥剧墖鈥旀垨鑰呬笉缂撳瓨25.灏介噺閬垮厤Date鏍煎紡鍖�

176.璇峰垪涓捐嚦灏戜簲涓猧OS涓父鐢ㄧ殑绗笁鏂圭被搴撱��

1锛�.AFNetworking

2锛�. SDWebImage

3锛�. shareKit

4锛�. FMDatebase

5锛�. MMDrawerController

177.闃熷垪鍜屾爤鏈変粈涔堝尯鍒��

鏍堬紙Stack锛夛細鏄檺瀹氬彧鑳藉湪琛ㄧ殑涓�绔繘琛屾彃鍏ュ拰鍒犻櫎鎿嶄綔鐨勭嚎鎬ц〃

闃熷垪锛圦ueue锛夋槸闄愬畾鍙兘鍦ㄨ〃鐨勪竴娈佃繘琛屾彃鍏ュ拰鍦ㄥ彟涓�绔繘琛屽垹闄ゆ搷浣滅殑鐨勭嚎鎬ц〃

1锛夈�侀槦鍒楁槸鍏堣繘鍏堝嚭锛屾爤鏄厛杩涘悗鍑�

2锛夈�侀亶鍘嗘暟鎹�熷害涓嶅悓锛岄槦鍒楅亶鍘嗛�熷害瑕佸揩寰楀

178.甯哥敤鐨刋ML鏂囦欢鐨勮В鏋愭柟寮忔湁鍝簺锛熷畠浠悇鑷殑鍖哄埆鏄粈涔堬紵

1锛夈�佹湁涓ょ瑙f瀽鏂瑰紡锛欴OM瑙f瀽涓嶴AX瑙f瀽

2锛夈�丏OM瑙f瀽蹇呴』鍏堝畬鎴怐OM鏍戠殑鍒涘缓锛屽湪澶勭悊瑙勬ā杈冨ぇXML鏂囨。鏃跺氨寰堣�楀唴瀛橈紝鍗犵敤璧勬簮杈冨

3锛変笌DOM涓嶅悓锛孲AX鏄敤浜嬩欢椹卞姩妯″瀷锛岃В鏋怷ML鏃舵瘡閬囧埌涓�涓紑濮嬫垨缁撴潫鏍囩銆佹垨鑰呭睘鎬с�佹垨鑰呬竴鏉℃寚浠ゆ椂锛岀▼搴忓氨浼氫骇鐢熶竴涓簨浠惰繘琛岀浉搴旂殑澶勭悊锛屽洜姝わ紝SAX鐩稿浜嶥OM鏉ヨ鏇撮�傚悎鎿嶄綔杈冨ぇ鐨刋ML鏂囨。

179.璇蜂粙缁嶅嚑涓父鐢ㄧ殑git鍛戒护銆�

git branch鏌ョ湅鏈湴鎵�鏈夊垎鏀�乬it status鏌ョ湅褰撳墠鐘舵�併�乬it commit鎻愪氦銆乬it branch -a鏌ョ湅鎵�鏈夌殑鍒嗘敮銆乬it

branch -r鏌ョ湅鏈湴鎵�鏈夊垎鏀�

180.璇风畝鍗曟弿杩颁竴涓嬭嚜宸辩殑鑱屼笟鐢熸动瑙勫垝銆�

涓嶇煡閬�

181.static鍏抽敭瀛楃殑浣滅敤

绛旀:

锛�1锛夎缃彉閲忕殑瀛樺偍鍩燂紝鍑芥暟浣撳唴static鍙橀噺鐨勪綔鐢ㄨ寖鍥翠负璇ュ嚱鏁颁綋锛屼笉鍚屼簬auto鍙橀噺锛岃鍙橀噺鐨勫唴瀛樺彧琚垎閰嶄竴娆★紝鍥犳鍏跺�煎湪涓嬫璋冪敤鏃朵粛缁存寔涓婃鐨勫�硷紱

锛�2锛夐檺鍒跺彉閲忕殑浣滅敤鍩燂紝鍦ㄦā鍧楀唴鐨剆tatic鍏ㄥ眬鍙橀噺鍙互琚ā鍧楀唴鎵�鐢ㄥ嚱鏁拌闂紝浣嗕笉鑳借妯″潡澶栧叾瀹冨嚱鏁拌闂紱

锛�3锛夐檺鍒跺嚱鏁扮殑浣滅敤鍩燂紝鍦ㄦā鍧楀唴鐨剆tatic鍑芥暟鍙彲琚繖涓�妯″潡鍐呯殑鍏跺畠鍑芥暟璋冪敤锛岃繖涓嚱鏁扮殑浣跨敤鑼冨洿琚檺鍒跺湪澹版槑瀹冪殑妯″潡鍐咃紱

锛�4锛夊湪绫讳腑鐨剆tatic鎴愬憳鍙橀噺鎰忓懗鐫�瀹冧负璇ョ被鐨勬墍鏈夊疄渚嬫墍鍏变韩锛屼篃灏辨槸璇村綋鏌愪釜绫荤殑瀹炰緥淇敼浜嗚闈欐�佹垚鍛樺彉閲忥紝鍏朵慨鏀瑰�间负璇ョ被鐨勫叾瀹冩墍鏈夊疄渚嬫墍瑙侊紱

锛�5锛夊湪绫讳腑鐨剆tatic鎴愬憳鍑芥暟灞炰簬鏁翠釜绫绘墍鎷ユ湁锛岃繖涓嚱鏁颁笉鎺ユ敹this鎸囬拡锛屽洜鑰屽彧鑳借闂被鐨剆tatic鎴愬憳鍙橀噺銆�

182.鍫嗗拰鏍堢殑鍖哄埆?

绛�:绛�:鏍堝畬鍏ㄦ槸鐢辩郴缁熺鐞嗙殑,鍫嗘槸鐢辩▼搴忓憳鑷繁鎺у埗绠$悊鐨�,鍖呮嫭鍐呭瓨绌洪棿鐨勫紑杈熷拰閲婃斁.鏍堟槸鍏堣繘鍚庡嚭.

183.鐩爣-鍔ㄤ綔鏈哄埗?

绛�:鐩爣鏄姩浣滄秷鎭殑鎺ユ敹鑰呫�備竴涓帶浠讹紝鎴栬�呮洿涓哄父瑙佺殑鏄畠鐨勫崟鍏冿紝浠ユ彃搴у彉閲忥紙鍙傝"鎻掑骇鍙橀噺"閮ㄥ垎锛�

鐨勫舰寮忎繚鏈夊叾鍔ㄤ綔娑堟伅鐨勭洰鏍囥��

鍔ㄤ綔鏄帶浠跺彂閫佺粰鐩爣鐨勬秷鎭紝鎴栬�呬粠鐩爣鐨勮搴︾湅锛屽畠鏄洰鏍囦负浜嗗搷搴斿姩浣滆�屽疄鐜扮殑鏂规硶銆�

绋嬪簭闇�瑕佹煇浜涙満鍒舵潵杩涜浜嬩欢鍜屾寚浠ょ殑缈昏瘧銆傝繖涓満鍒跺氨鏄洰鏍�-鍔ㄤ綔鏈哄埗

184.鑷姩閲婃斁姹犳槸浠�涔�,濡傚悎宸ヤ綔?

绛�:褰撳悜涓�涓璞″彂閫佷竴涓猘utorelease娑堟伅鏃讹紝Cocoa灏变細灏嗚瀵硅薄鐨勪竴涓紩鐢ㄦ斁鍏ュ埌鏈�鏂扮殑鑷姩閲婃斁姹犮�傚畠浠嶇劧鏄釜姝e綋鐨勫璞★紝鍥犳鑷姩閲婃斁姹犲畾涔夌殑浣滅敤鍩熷唴鐨勫叾瀹冨璞″彲浠ュ悜瀹冨彂閫佹秷鎭�傚綋绋嬪簭鎵ц鍒颁綔鐢ㄥ煙缁撴潫鐨勪綅缃椂锛岃嚜鍔ㄩ噴鏀炬睜灏变細琚噴鏀撅紝姹犱腑鐨勬墍鏈夊璞′篃灏辫閲婃斁銆�

185. obj-c鐨勪紭缂虹偣

绛�: objc浼樼偣锛�

1) Cateogies

2) Posing

3)鍔ㄦ�佽瘑鍒�

4)鎸囨爣璁$畻

5锛夊脊鎬ц鎭紶閫�

6)涓嶆槸涓�涓繃搴﹀鏉傜殑C琛嶇敓璇█

7) Objective-C涓嶤++鍙贩鍚堢紪绋�

缂虹偣:

1)涓嶆敮鎻村懡鍚嶇┖闂�

2)涓嶆敮鎸佽繍绠楃閲嶈浇

3锛変笉鏀寔澶氶噸缁ф壙

4锛変娇鐢ㄥ姩鎬佽繍琛屾椂绫诲瀷锛屾墍鏈夌殑鏂规硶閮芥槸鍑芥暟璋冪敤锛屾墍浠ュ緢澶氱紪璇戞椂浼樺寲鏂规硶閮界敤涓嶅埌銆傦紙濡傚唴鑱斿嚱鏁扮瓑锛夛紝鎬ц兘浣庡姡銆�

OC娌℃湁澶氶噸缁ф壙锛孞ava涔熸病鏈塁++鎵嶆湁

OC浣跨敤鍗忚鏉ュ疄鐜板閲嶇户鎵�

186.浠�涔堟椂鍊欑敤delegate,浠�涔堟椂鍊欑敤Notification?

绛�: Delegate

娑堟伅鐨勫彂閫佽��(sender)鍛婄煡鎺ュ彈鑰�(receiver)鏌愪釜浜嬩欢灏嗚鍙戠敓, delegate鍚屾剰鍚庡彂閫佽�呭搷搴斾簨浠�,delegate鏈哄埗浣垮緱鎺ュ彈鑰呭彲浠ユ敼鍙樺彂閫佽�呯殑琛屼负.

1/浼犲��

b鎶婅嚜宸辩殑鏁版嵁鍜屽璞′紶缁檃,璁゛鍘诲睍绀烘垨澶勭悊

2/浼犱簨浠�

delegate鐨勪紭鍔匡細

1.闈炲父涓ユ牸鐨勮娉曘�傛墍鏈夊皢鍚埌鐨勪簨浠跺繀椤绘槸鍦╠elegate鍗忚涓湁娓呮櫚鐨勫畾涔夈��

2.濡傛灉delegate涓殑涓�涓柟娉曟病鏈夊疄鐜伴偅涔堝氨浼氬嚭鐜扮紪璇戣鍛�/閿欒

3.鍗忚蹇呴』鍦╟ontroller鐨勪綔鐢ㄥ煙鑼冨洿鍐呭畾涔�

4.鍦ㄤ竴涓簲鐢ㄤ腑鐨勬帶鍒舵祦绋嬫槸鍙窡韪殑骞朵笖鏄彲璇嗗埆鐨勶紱

5.鍦ㄤ竴涓帶鍒跺櫒涓彲浠ュ畾涔夊畾涔夊涓笉鍚岀殑鍗忚锛屾瘡涓崗璁湁涓嶅悓鐨刣elegates

6.娌℃湁绗笁鏂瑰璞¤姹備繚鎸�/鐩戣閫氫俊杩囩▼銆�

7.鑳藉鎺ユ敹璋冪敤鐨勫崗璁柟娉曠殑杩斿洖鍊笺�傝繖鎰忓懗鐫�delegate鑳藉鎻愪緵鍙嶉淇℃伅缁檆ontroller

Notification

娑堟伅鐨勫彂閫佽�呭憡鐭ユ帴鍙楄�呬簨浠跺凡缁忓彂鐢熸垨鑰呭皢瑕佸彂閫�(鎺ュ彈鑰呬笉鑳藉奖鍝嶅彂閫佽�呯殑琛屼负)

娑堟伅鎺ュ彈鑰呴�氳繃keyPath鐨勬柟寮忔寚瀹氶渶瑕佹帴鍙楃殑娑堟伅绫诲瀷,閫氬父鍦ㄥ璞″垵濮嬪寲瀹屾垚涔嬪悗澹版槑寮�濮嬫帴鏀舵秷鎭湪瀵硅薄琚攢姣佸墠娉ㄩ攢鎺ユ敹娑堟伅.

notification浼樺娍锛�

1.涓嶉渶瑕佺紪鍐欏灏戜唬鐮侊紝瀹炵幇姣旇緝绠�鍗曪紱

2.瀵逛簬涓�涓彂鍑虹殑閫氱煡锛屽涓璞¤兘澶熷仛鍑哄弽搴旓紝鍗�1瀵瑰鐨勬柟寮忓疄鐜扮畝鍗�

Delegate鍜孨otification鍖哄埆

1/浜岃�呴兘鐢ㄤ簬浼犻�掓秷鎭�.

delegate閽堝one - to - one鍏崇郴receiver鍙互杩斿洖鍊肩粰sender.

notification鐢ㄤ簬one - to - one /

many / none鍏崇郴receiver鏃犳硶杩斿洖鍊肩粰sender.

2/delegate涓よ�呬箣闂村繀椤诲缓绔嬭仈绯诲惁鍒欐病鍔炴硶璋冪敤浠g悊鏂规硶.

notification涓嶉渶瑕佷袱鑰呬箣闂存湁鑱旂郴.

3/delegate鐢ㄤ簬甯屾湜sender鎺ュ彈鍒皉eceiver鐨勬煇涓姛鑳藉�煎弽棣�

notification鐢ㄤ簬閫氱煡澶氫釜object鏌愪釜浜嬩欢

4/notification閫氳繃缁存姢涓�涓猘rray锛屽疄鐜颁竴瀵瑰娑堟伅鐨勮浆鍙�

187.浠�涔堟槸KVC鍜孠VO?

绛�: Key value coding锛孠ey value observer.

Kvc鏄矾寰勮闂殑瑙勮寖锛宬vo鏄瀵熸煇涓彉閲忕殑鍙樺寲杩囩▼

KVO鍙互瑙傚療鏌愪釜瀵硅薄鐨勫彉閲忓彉鍖栬繃绋嬶紝KVC鏄弧瓒宠瑙傚療鐨勭紪

鐮佽鑼冦��

KVC/KVO绫讳技浜庝唬鐞嗭紝閫氱煡涓績銆傞兘鏄竴绉嶉�氳鏂规硶銆�

188.绫诲埆鐨勪綔鐢�?

绛�:绫诲埆涓昏鏈�3涓綔鐢細

(1)灏嗙被鐨勫疄鐜板垎鏁e埌澶氫釜涓嶅悓鏂囦欢鎴栧涓笉鍚屾鏋朵腑銆�

(2)鍒涘缓瀵圭鏈夋柟娉曠殑鍓嶅悜寮曠敤銆�

(3)鍚戝璞℃坊鍔犻潪姝e紡鍗忚

189.娴呭鍒跺拰娣卞鍒剁殑鍖哄埆?

绛�:绠�鍗曠殑鏉ヨ灏辨槸锛屽湪鏈夋寚閽堢殑鎯呭喌涓嬶紝娴呮嫹璐濆彧鏄鍔犱簡涓�涓寚閽堟寚鍚戝凡缁忓瓨鍦ㄧ殑鍐呭瓨锛岃�屾繁鎷疯礉灏辨槸澧炲姞涓�涓寚閽堝苟涓旂敵璇蜂竴涓柊鐨勫唴瀛橈紝浣胯繖涓鍔犵殑鎸囬拡鎸囧悜杩欎釜鏂扮殑鍐呭瓨锛岄噰鐢ㄦ繁鎷疯礉鐨勬儏鍐典笅锛岄噴鏀惧唴瀛樼殑鏃跺�欏氨涓嶄細鍑虹幇鍦ㄦ祬鎷疯礉鏃堕噸澶嶉噴鏀惧悓涓�鍐呭瓨鐨勯敊璇紒

190.浠g悊鐨勪綔鐢�?

绛�:浣滅敤鏈変袱涓紝涓�涓槸浼犲�硷紝涓�涓槸浼犱簨浠�

191.鎴戜滑璇寸殑OC鏄姩鎬佽繍琛屾椂璇█鏄粈涔堟剰鎬�?

澶氭�併��

绛�:涓昏鏄皢鏁版嵁绫诲瀷鐨勭‘瀹氱敱缂栬瘧鏃讹紝鎺ㄨ繜鍒颁簡杩愯鏃躲��

杩欎釜闂鍏跺疄娴呮秹鍙婂埌涓や釜姒傚康锛岃繍琛屾椂鍜屽鎬併��

绠�鍗曟潵璇达紝杩愯鏃舵満鍒朵娇鎴戜滑鐩村埌杩愯鏃舵墠鍘诲喅瀹氫竴涓璞$殑绫诲埆锛屼互鍙婅皟鐢ㄨ绫诲埆瀵硅薄鎸囧畾鏂规硶銆傚鎬侊細涓嶅悓瀵硅薄浠ヨ嚜宸辩殑鏂瑰紡鍝嶅簲鐩稿悓鐨勬秷鎭殑鑳藉姏鍙仛澶氭�併��

鎰忔�濆氨鏄亣璁剧敓鐗╃被锛坙ife锛夐兘鐢ㄦ湁涓�涓浉鍚岀殑鏂规硶-eat;閭d汉绫诲睘浜庣敓鐗╋紝鐚篃灞炰簬鐢熺墿锛岄兘缁ф壙浜唋ife鍚庯紝瀹炵幇鍚勮嚜鐨別at锛屼絾鏄皟鐢ㄦ槸鎴戜滑鍙渶璋冪敤鍚勮嚜鐨別at鏂规硶銆�

涔熷氨鏄笉鍚岀殑瀵硅薄浠ヨ嚜宸辩殑鏂瑰紡鍝嶅簲浜嗙浉鍚岀殑娑堟伅锛堝搷搴斾簡eat杩欎釜閫夋嫨鍣級銆�

鍥犳涔熷彲浠ヨ锛岃繍琛屾椂鏈哄埗鏄鎬佺殑鍩虹銆�

198.Object鈥揅鐨勭被鍙互澶氶噸缁ф壙鍚�?鍙互瀹炵幇澶氫釜鎺ュ彛鍚�?

Category鏄粈涔�?閲嶅啓涓�涓被鐨勬柟娉曠敤缁ф壙濂借繕鏄垎绫诲ソ?涓轰粈涔�?

绛旀锛歄bject-c鐨勭被涓嶅彲浠ュ閲嶇户鎵匡紱鍙互瀹炵幇澶氫釜鎺ュ彛锛岄�氳繃瀹炵幇澶氫釜鎺ュ彛鍙互瀹屾垚C++鐨勫閲嶇户鎵匡紱Category鏄被鍒紝涓�鑸儏鍐电敤鍒嗙被濂斤紝鐢–ategory鍘婚噸鍐欑被鐨勬柟娉曪紝浠呭鏈珻ategory鏈夋晥锛屼笉浼氬奖鍝嶅埌鍏朵粬绫讳笌鍘熸湁绫荤殑鍏崇郴銆�

199..灞炴�eadwrite , readonly , assign , retain , copy , nonatomic ,鍚勬槸浠�涔堜綔鐢�,鍦ㄥ摢绉嶆儏鍐典笅鐢�?

绛�:

assign鐢ㄤ簬绠�鍗曟暟鎹被鍨嬶紝濡侼SInteger,double,bool,

retain鍜宑opy鐢ㄤ簬瀵硅薄锛�

readwrite鏄彲璇诲彲鍐欑壒鎬э紱闇�瑕佺敓鎴恎etter鏂规硶鍜宻etter鏂规硶鏃�

readonly鏄彧璇荤壒鎬у彧浼氱敓鎴恎etter鏂规硶涓嶄細鐢熸垚setter鏂规硶;涓嶅笇鏈涘睘鎬у湪绫诲鏀瑰彉

assign鏄祴鍊肩壒鎬э紝setter鏂规硶灏嗕紶鍏ュ弬鏁拌祴鍊肩粰瀹炰緥鍙橀噺锛涗粎璁剧疆鍙橀噺鏃讹紱

retain琛ㄧず鎸佹湁鐗规�э紝setter鏂规硶灏嗕紶鍏ュ弬鏁板厛淇濈暀锛屽啀璧嬪�硷紝浼犲叆鍙傛暟鐨剅etaincount浼�+1;

copy琛ㄧず璧嬪�肩壒鎬э紝setter鏂规硶灏嗕紶鍏ュ璞″鍒朵竴浠斤紱闇�瑕佷竴浠芥柊鐨勫彉閲忔椂銆�

nonatomic闈炲師瀛愭搷浣滐紝atomic鍘熷瓙鎬ф搷浣溿�傚師瀛愭�ф寚鐨勬槸涓�涓搷浣滀笉鍙互琚腑閫攃pu鏆傚仠鐒跺悗璋冨害,鍗充笉鑳借涓柇,瑕佷笉灏辨墽琛屽畬,瑕佷笉灏变笉鎵ц锛屽氨鏄负浜嗗绾跨▼瀹夊叏鐨勩��

涓�鑸娇鐢╪onatomic銆�

201.鍐呭瓨绠$悊鐨勫嚑鏉″師鍒欐槸浠�涔�?鎸夌収榛樿娉曞垯,鍝簺鍏抽敭瀛楃敓鎴愮殑瀵硅薄闇�瑕佹墜鍔ㄩ噴鏀�,鍦ㄥ拰property缁撳悎鐨勬椂鍊欐�庢牱鏈夋晥鐨勯伩鍏嶅唴瀛樻硠闇�?

绛�:褰撲娇鐢╪ew銆乤lloc鎴朿opy鏂规硶鍒涘缓涓�涓璞℃椂锛岃瀵硅薄寮曠敤璁℃暟鍣ㄤ负1銆傚鏋滀笉闇�瑕佷娇鐢ㄨ瀵硅薄锛屽彲浠ュ悜鍏跺彂閫乺elease鎴朼utorelease娑堟伅锛屽湪鍏朵娇鐢ㄥ畬姣曟椂琚攢姣併��

濡傛灉閫氳繃鍏朵粬鏂规硶鑾峰彇涓�涓璞★紝鍒欏彲浠ュ亣璁捐繖涓璞″紩鐢ㄨ鏁颁负1锛屽苟涓旇璁剧疆涓篴utorelease锛屼笉闇�瑕佸璇ュ璞¤繘琛屾竻鐞嗭紝濡傛灉纭疄闇�瑕乺etain杩欎釜瀵硅薄锛屽垯闇�瑕佷娇鐢ㄥ畬姣曞悗release銆�

濡傛灉retain浜嗘煇涓璞★紝闇�瑕乺elease鎴朼utorelease璇ュ璞★紝淇濇寔retain鏂规硶鍜宺elease鏂规硶浣跨敤娆℃暟鐩哥瓑銆�

浣跨敤new銆乤lloc銆乧opy鍏抽敭瀛楃敓鎴愮殑瀵硅薄鍜宺etain浜嗙殑瀵硅薄闇�瑕佹墜鍔ㄩ噴鏀俱�傝缃负autorelease鐨勫璞′笉闇�瑕佹墜鍔ㄩ噴鏀撅紝浼氱洿鎺ヨ繘鍏ヨ嚜鍔ㄩ噴鏀炬睜銆�

202.鍫嗗拰鏍堜粈涔堝尯鍒紵

绛�:涓�銆佸爢鏍堢┖闂村垎閰嶅尯鍒細

1銆佹爤锛堟搷浣滅郴缁燂級锛氱敱鎿嶄綔绯荤粺鑷姩鍒嗛厤閲婃斁锛屽瓨鏀惧嚱鏁扮殑鍙傛暟鍊硷紝灞�閮ㄥ彉閲忕殑鍊肩瓑銆傚叾鎿嶄綔鏂瑰紡绫讳技浜庢暟鎹粨鏋勪腑鐨勬爤锛�

2銆佸爢锛堟搷浣滅郴缁燂級锛氫竴鑸敱绋嬪簭鍛樺垎閰嶉噴鏀撅紝鑻ョ▼搴忓憳涓嶉噴鏀撅紝绋嬪簭缁撴潫鏃跺彲鑳界敱OS鍥炴敹锛屽垎閰嶆柟寮忓�掓槸绫讳技浜庨摼琛ㄣ��

浜屻�佸爢鏍堢紦瀛樻柟寮忓尯鍒細

1銆佹爤浣跨敤鐨勬槸涓�绾х紦瀛橈紝浠栦滑閫氬父閮芥槸琚皟鐢ㄦ椂澶勪簬瀛樺偍绌洪棿涓紝璋冪敤瀹屾瘯绔嬪嵆閲婃斁锛�

2銆佸爢鏄瓨鏀惧湪浜岀骇缂撳瓨涓紝鐢熷懡鍛ㄦ湡鐢辫櫄鎷熸満鐨勫瀮鍦惧洖鏀剁畻娉曟潵鍐冲畾锛堝苟涓嶆槸涓�鏃︽垚涓哄鍎垮璞″氨鑳借鍥炴敹锛夈�傛墍浠ヨ皟鐢ㄨ繖浜涘璞$殑閫熷害瑕佺浉瀵规潵寰椾綆涓�浜涖��

涓夈�佸爢鏍堟暟鎹粨鏋勫尯鍒細

鍫嗭紙鏁版嵁缁撴瀯锛夛細鍫嗗彲浠ヨ鐪嬫垚鏄竴妫垫爲锛屽锛氬爢鎺掑簭锛�

鏍堬紙鏁版嵁缁撴瀯锛夛細涓�绉嶅厛杩涘悗鍑虹殑鏁版嵁缁撴瀯銆�

203.鎻忚堪涓�涓媔OS SDK涓浣曞疄鐜癕VC璁捐妯″紡锛�

绛�:

MVC鏄ā鍨嬨�佽瘯鍥俱�佹帶鍒跺紑鍙戞ā寮忥紝瀵逛簬iOS

SDK锛屾墍鏈夌殑View閮芥槸瑙嗗浘灞傜殑锛屽畠搴旇鐙珛浜庢ā鍨嬪眰锛岀敱瑙嗗浘鎺у埗灞傛潵鎺у埗銆傛墍鏈夌殑鐢ㄦ埛鏁版嵁閮芥槸妯″瀷灞傦紝瀹冨簲璇ョ嫭绔嬩簬瑙嗗浘銆傛墍鏈夌殑ViewController閮芥槸鎺у埗灞傦紝鐢卞畠璐熻矗鎺у埗瑙嗗浘锛岃闂ā鍨嬫暟鎹��

204.iOS鏁版嵁鎸佷箙鍖栨柟寮忔湁鍝簺锛�

205鍜�199涓�鏍峰垹闄�205

206.鑷姩閲婃斁姹犳槸浠�涔堬紝濡備綍宸ヤ綔锛�

绛�:褰撴偍鍚戜竴涓璞″彂閫佷竴涓猘utorelease娑堟伅鏃讹紝Cocoa灏变細灏嗚瀵硅薄鐨勪竴涓紩鐢ㄦ斁鍏ュ埌鏈�鏂扮殑鑷姩閲婃斁姹犮�傚畠浠嶇劧鏄釜姝e綋鐨勫璞★紝鍥犳鑷姩閲婃斁姹犲畾涔夌殑浣滅敤鍩熷唴鐨勫叾瀹冨璞″彲浠ュ悜瀹冨彂閫佹秷鎭�傚綋绋嬪簭鎵ц鍒颁綔鐢ㄥ煙缁撴潫鐨勪綅缃椂锛岃嚜鍔ㄩ噴鏀炬睜灏变細琚噴鏀撅紝姹犱腑鐨勬墍鏈夊璞′篃灏辫閲婃斁銆�

207. if you can Android/Windows Phone,write something about the comparison between it and iOS

缈昏瘧濡傛灉浣犳湁Android /

Windows Phone鐨勬墜鏈猴紝鍐欎竴浜涘叧浜庡畠涓巌OS璁惧涔嬮棿鐨勬瘮杈�

绛旀:鑷繁鍙戞尌

208. Write something about the differencesbetween Objective-C and C++.

缈昏瘧鍐欎竴浜涘叧浜嶰bjective-C鍜孋++涔嬮棿鐨勫樊寮�

绛旀:

1銆丱bjective C鍩烘湰涓婃槸鍦– +

Smalltalk鍩虹涓婅鐢熷嚭鏉ョ殑锛孋++灏辨槸C++銆傞櫎浜嗛兘鏄粠C璇█鍒嗗寲鍑烘潵鐨勪互澶栵紝瀹屽叏娌℃湁浠讳綍鍏辨�с��

2銆佹渶澶х殑鍖哄埆灏辨槸Objective C鐨勬垚鍛樺嚱鏁拌皟鐢ㄦ槸鍩轰簬鍔ㄦ�佺粦瀹氱殑锛岀被鏈韩骞舵病鏈夐檺鍒跺璞″彲浠ユ湁浠�涔堝嚱鏁般�傜浉瀵逛簬C++绫讳細瑙勫畾濂芥垚鍛樻湁浠�涔堝嚱鏁般�傝繖浣垮緱Objective C鐨勭伒娲绘�у緢澶э紝浣嗘槸鎵ц鏁堢巼涔熷緢浣庛��

3銆佸湪NeXT绯荤粺鐨勬椂浠++鍜孫bjective C閮戒笉鏄偅涔堝ぇ浼楃殑涓滆タ锛孋++涔熻繕娌″畬鍠勶紝鑰屼笖閭d釜鏃朵唬缂栬瘧鍣ㄧ殑鏈変紭鍖栬兘鍔涗篃娌$幇鍦ㄩ偅涔堝彉鎬併�傛墍浠ラ�夋嫨Objective C涔熶笉鏄緢濂囨�殑浜嬨�備絾鏄幇鍦∣bjective C鐨勫姡鍔垮氨瓒婃潵瓒婃槑鏄句簡锛屾墍浠ヨ嫻鏋滃紑鍙戜簡Swift锛岃�屼笖灏卞唴閮ㄦ秷鎭嫻鏋滃緢鍙兘浼氬噯澶囨斁寮僌C銆�

209. __unsafe_unretained vs__weak; purposeof __block; NSString const * vs NSString *const

unsafe_unretained寰�寰�閮芥槸鐢ㄦ潵澹版槑灞炴�х殑锛屽鏋滄兂澹版槑涓存椂鍙橀噺灏卞緱鐢╛_strong,__weak,__unsafe_unretained,__autoreleasing;

block闂寘灏辨槸鑳藉璇诲彇鍏跺畠鍑芥暟鍐呴儴鍙橀噺鐨勫嚱鏁�;

NSString const *HSCoder = @"姹夋柉鍝堝搱鍝�";

"*HSCoder"涓嶈兘琚慨鏀癸紝"HSCoder"鑳借淇敼

NSString * const HSCoder = @"姹夋柉鍝堝搱鍝�";

"HSCoder"涓嶈兘琚慨鏀癸紝"*HSCoder"鑳借淇敼

210. Write something about what you achievedby and what you learned from the UITableView class

棣栧厛锛孋ontroller闇�瑕佸疄鐜颁袱涓猟elegate锛屽垎鍒槸UITableViewDelegate鍜孶ITableViewDataSource鐒跺悗UITableView瀵硅薄鐨刣elegate瑕佽缃负self,娉ㄥ唽cell,涔嬪悗缁欏畾鍒嗗尯鏁板拰琛屾暟,娉ㄦ剰cell鐨勯噸鐢ㄦ満鍒�,鍙互璁剧疆绯荤粺cell鎴栬�呰嚜瀹氫箟cell

211.浣犲澶╁仴鍏徃鏈夊摢浜涗簡瑙o紵浣犱负浠�涔堟効鎰忔垚涓哄ぉ鍋ュ叕鍙哥殑涓�鍛橈紵

212. Object C涓垱寤虹嚎绋嬬殑鏂规硶鏄粈涔�?濡傛灉鍦ㄤ富绾跨▼涓墽琛屼唬鐮�,鏂规硶鏄粈涔�?濡傛灉鎯冲欢鏃舵墽琛屼唬鐮�,鏂规硶鍙堟槸浠�涔�?

绾跨▼鍒涘缓鏈変笁绉嶆柟娉曪細浣跨敤NSThread鍒涘缓銆佷娇鐢℅CD鐨刣ispatch銆佷娇鐢ㄥ瓙绫诲寲鐨凬SOperation,鐒跺悗灏嗗叾鍔犲叆NSOperationQueue;

鍦ㄤ富绾跨▼鎵ц浠g爜锛屾柟娉曟槸performSelectorOnMainThread锛�

濡傛灉鎯冲欢鏃舵墽琛屼唬鐮佸彲浠ョ敤performSelector:onThread:withObject: afterDelay:鎴栬�呬娇鐢℅CD鐨勫嚱鏁帮細dispatch_after(dispatch_time(DISPATCH_TIME_NOW,(int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

// 2绉掑悗寮傛鎵ц杩欓噷鐨勪唬鐮�...

});

213.鎻忚堪涓�涓媔OS SDK涓浣曞疄鐜癕VC鐨勫紑鍙戞ā寮�

MVC鏄ā鍨嬨�佽鍥俱�佹帶鍒跺櫒寮�鍙戞ā寮忥紝瀵逛簬iOS

SDK锛屾墍鏈夌殑View閮芥槸瑙嗗浘灞傜殑锛屽畠搴旇鐙珛浜庢ā鍨嬪眰锛岀敱瑙嗗浘鍣ㄦ潵鎺у埗銆傛墍鏈夌殑鐢ㄦ埛鏁版嵁閮芥槸妯″瀷灞傦紝瀹冨簲璇ョ嫭绔嬩簬瑙嗗浘銆傛墍鏈夌殑ViewController閮芥槸瑙嗗浘鍣紝鐢卞畠璐熻矗鎺у埗瑙嗗浘锛岃闂ā鍨嬫暟鎹��

214.绠�杩版祬鎷疯礉鍜屾繁鎷疯礉

绛旀锛氭祬灞傚鍒讹細鍙鍒舵寚鍚戝璞$殑鎸囬拡锛岃�屼笉澶嶅埗寮曠敤瀵硅薄鏈韩銆�

娣卞眰澶嶅埗锛氬鍒跺紩鐢ㄥ璞℃湰韬��

鎰忔�濆氨鏄鎴戞湁涓狝瀵硅薄锛屽鍒朵竴浠藉悗寰楀埌A_copy瀵硅薄鍚庯紝瀵逛簬娴呭鍒舵潵璇达紝A鍜孉_copy鎸囧悜鐨勬槸鍚屼竴涓唴瀛樿祫婧愶紝澶嶅埗鐨勫彧涓嶈繃鏄槸涓�涓寚閽堬紝瀵硅薄鏈韩璧勬簮

杩樻槸鍙湁涓�浠斤紝閭e鏋滄垜浠A_copy鎵ц浜嗕慨鏀规搷浣�,閭d箞鍙戠幇A寮曠敤鐨勫璞″悓鏍疯淇敼锛岃繖鍏跺疄杩濊儗浜嗘垜浠鍒舵嫹璐濈殑涓�涓�濇兂銆傛繁澶嶅埗灏卞ソ鐞嗚В浜�,鍐呭瓨涓瓨鍦ㄤ簡

涓や唤鐙珛瀵硅薄鏈韩銆�

鐢ㄧ綉涓婁竴鍝ヤ滑閫氫織鐨勮瘽灏嗗氨鏄細

娴呭鍒跺ソ姣斾綘鍜屼綘鐨勫奖瀛愶紝浣犲畬铔嬶紝浣犵殑褰卞瓙涔熷畬铔�

娣卞鍒跺ソ姣斾綘鍜屼綘鐨勫厠闅嗕汉锛屼綘瀹岃泲锛屼綘鐨勫厠闅嗕汉杩樻椿鐫�銆�

215.鍦╥Phone搴旂敤涓浣曚繚瀛樻暟鎹�?

XML灞炴�у垪琛紙plist锛夊綊妗�

Preference(鍋忓ソ璁剧疆)

NSKeyedArchiver褰掓。(NSCoding)

SQLite3

Core Data

216.ViewController鐨刣idReceiveMemoryWarning鎬庝箞琚皟鐢�:

1銆佸綋绋嬪簭鏀跺埌鍐呭瓨璀﹀憡鏃跺�橵iewController浼氳皟鐢╠idReceiveMemoryWarning杩欎釜鏂规硶銆�

2銆佽皟鐢ㄤ簡杩欎釜鏂规硶涔嬪悗锛屽view杩涜閲婃斁骞朵笖璋冪敤viewDidUnload鏂规硶

3銆佷粠iOS3.0寮�濮嬶紝涓嶉渶瑕侀噸杞借繖涓嚱鏁帮紝鎶婇噴鏀惧唴瀛樼殑浠g爜鏀惧埌viewDidUnload涓幓銆�

217.鍐欎竴涓鎵樼殑interface

1.澹版槑涓�涓崗璁紙鍙湁.h鏂囦欢锛�

#import

@protocal鍗忚鍚峴uperMan<鐖跺崗璁甆SObject>

@property NSString* name;

-(void)method;

@end

2.浣夸竴涓被閬靛畧鍗忚

@interface TRMan:NSObject

澶氫釜鍗忚瑕佺敤锛岄殧寮�

3.浣跨敤鍗忚

id<鍗忚鍚峴uperMan>obj=[[TRMan alloc]init];

@ protocol MyDelegate

@interface MyClass : NSObject

@property(nonatomic,weak)id delegate;

@end

鍗忚涔熷彲浠ユ病鏈夌嫭绔嬫枃浠讹紝鍐欏湪绫婚噷

#import

@class MyClass;

@protocol MyClassDelegate

-(void)protocolMethod;

@end

@interface MyClass : NSObject

@property(nonatomic,weak)id delegate;

@end

218.绾跨▼涓庤繘绋嬬殑鍖哄埆涓庤仈绯�

杩涚▼锛屾槸骞跺彂鎵ц鐨勭▼搴忓湪鎵ц杩囩▼涓垎閰嶅拰绠$悊璧勬簮鐨勫熀鏈崟浣嶏紝鏄竴涓姩鎬佹蹇碉紝绔熶簤璁$畻鏈虹郴缁熻祫婧愮殑鍩烘湰鍗曚綅銆傛瘡涓�涓繘绋嬮兘鏈変竴涓嚜宸辩殑鍦板潃绌洪棿锛屽嵆杩涚▼绌洪棿鎴栵紙铏氱┖闂达級銆傝繘绋嬬┖闂寸殑澶у皬鍙笌澶勭悊鏈虹殑浣嶆暟鏈夊叧锛屼竴涓�16浣嶉暱澶勭悊鏈虹殑杩涚▼绌洪棿澶у皬涓�216锛岃��32浣嶅鐞嗘満鐨勮繘绋嬬┖闂村ぇ灏忎负232銆傝繘绋嬭嚦灏戞湁5绉嶅熀鏈姸鎬侊紝瀹冧滑鏄細鍒濆鎬侊紝鎵ц鎬侊紝绛夊緟鐘舵�侊紝灏辩华鐘舵�侊紝缁堟鐘舵�併��

绾跨▼锛屽湪缃戠粶鎴栧鐢ㄦ埛鐜涓嬶紝涓�涓湇鍔″櫒閫氬父闇�瑕佹帴鏀跺ぇ閲忎笖涓嶇‘瀹氭暟閲忕敤鎴风殑骞跺彂璇锋眰锛屼负姣忎竴涓姹傞兘鍒涘缓涓�涓繘绋嬫樉鐒舵槸琛屼笉閫氱殑锛屸�斺�旀棤璁烘槸浠庣郴缁熻祫婧愬紑閿�鏂归潰鎴栨槸鍝嶅簲鐢ㄦ埛璇锋眰鐨勬晥鐜囨柟闈㈡潵鐪嬨�傚洜姝わ紝鎿嶄綔绯荤粺涓嚎绋嬬殑姒傚康渚胯寮曡繘浜嗐��

绾跨▼锛屾槸杩涚▼鐨勪竴閮ㄥ垎锛屼竴涓病鏈夌嚎绋嬬殑杩涚▼鍙互琚湅浣滄槸鍗曠嚎绋嬬殑銆傜嚎绋嬫湁鏃跺張琚О涓鸿交鏉冭繘绋嬫垨杞婚噺绾ц繘绋嬶紝涔熸槸CPU璋冨害鐨勪竴涓熀鏈崟浣嶃��

219.mvc璁捐妯″紡鏄粈涔�?浣犺繕鐔熸倝浠�涔堣璁℃ā寮�

绛�:绯荤粺鍒嗕负涓変釜閮ㄥ垎: Model. View. Controller.鍦╟ocoa涓�,浣犵殑绋嬪簭涓殑姣忎竴涓猳bject

(瀵硅薄)閮藉皢鏄庢樉鍦颁粎灞炰簬杩欎笁閮ㄥ垎涓殑涓�涓�,鑰屽畬鍏ㄤ笉灞炰簬鍙﹀涓や釜.MVC璇句竴甯姪纭繚甯姪瀹炵幇绋嬪簭鏈�澶х▼搴︾殑鍙噸鐢ㄦ��.鍚凪VC鍏冪礌褰兼鐙珛杩愪綔,閫氳繃鍒嗗紑杩欎簺鍏冪礌,鍙互鏋勫缓鍙淮鎶�,鍙嫭绔嬫洿鏂扮殑绋嬪簭缁勫缓.

Delegate璁捐妯″紡

Target-action璁捐妯″紡

鍗曚緥妯″紡

220.浠�涔堟槸娌欑妯″紡?鍝簺鎿嶄綔灞炰簬绉佹湁api鑼冪暣

鏌愪釜iphone宸ョ▼杩涜鏂囦欢鎿嶄綔鏈夋宸ョ▼瀵瑰簲鐨勬寚瀹氱殑浣嶇疆锛屼笉鑳介�捐秺銆�

iphone娌欑妯″瀷鐨勬湁鍥涗釜鏂囦欢澶癸紝鍒嗗埆鏄粈涔堬紝姘镐箙鏁版嵁瀛樺偍涓�鑸斁鍦ㄤ粈涔堜綅缃紝寰楀埌妯℃嫙鍣ㄧ殑璺緞鐨勭畝鍗曟柟寮忔槸浠�涔�.

documents锛宼mp锛宎pp锛孡ibrary銆�

锛圢SHomeDirectory()锛夛紝

鎵嬪姩淇濆瓨鐨勬枃浠跺湪documents鏂囦欢閲�

Nsuserdefaults淇濆瓨鐨勬枃浠跺湪tmp鏂囦欢澶归噷

Documents鐩綍锛氭偍搴旇灏嗘墍鏈塪e搴旂敤绋嬪簭鏁版嵁鏂囦欢鍐欏叆鍒拌繖涓洰褰曚笅銆傝繖涓洰褰曠敤浜庡瓨鍌ㄧ敤鎴锋暟鎹垨鍏跺畠搴旇瀹氭湡澶囦唤鐨勪俊鎭��

AppName.app鐩綍锛氳繖鏄簲鐢ㄧ▼搴忕殑绋嬪簭鍖呯洰褰曪紝鍖呭惈搴旂敤绋嬪簭鐨勬湰韬�傜敱浜庡簲鐢ㄧ▼搴忓繀椤荤粡杩囩鍚嶏紝

鎵�浠ユ偍鍦ㄨ繍琛屾椂涓嶈兘瀵硅繖涓洰褰曚腑鐨勫唴瀹硅繘琛屼慨鏀癸紝鍚﹀垯鍙兘浼氫娇搴旂敤绋嬪簭鏃犳硶鍚姩銆侺ibrary鐩綍锛氳繖涓洰褰曚笅鏈変袱涓瓙鐩綍锛欳aches鍜孭references

Preferences鐩綍鍖呭惈搴旂敤绋嬪簭鐨勫亸濂借缃枃浠躲�傛偍涓嶅簲璇ョ洿鎺ュ垱寤哄亸濂借缃枃浠讹紝鑰屾槸搴旇浣跨敤NSUserDefaults绫绘潵鍙栧緱鍜岃缃簲鐢ㄧ▼搴忕殑鍋忓ソ.

Caches鐩綍鐢ㄤ簬瀛樻斁搴旂敤绋嬪簭涓撶敤鐨勬敮鎸佹枃浠讹紝淇濆瓨搴旂敤绋嬪簭鍐嶆鍚姩杩囩▼涓渶瑕佺殑淇℃伅銆倀mp鐩綍锛氳繖涓洰褰曠敤浜庡瓨鏀句复鏃舵枃浠讹紝淇濆瓨搴旂敤绋嬪簭鍐嶆鍚姩杩囩▼涓笉闇�瑕佺殑淇℃伅銆傝幏鍙栬繖浜涚洰褰曡矾寰勭殑鏂规硶锛�

1锛岃幏鍙栧鐩綍璺緞鐨勫嚱鏁帮細

NSString*homeDir=NSHomeDirectory();

2锛岃幏鍙朌ocuments鐩綍璺緞鐨勬柟娉曪細

NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

NSString*docDir=[pathsobjectAtIndex:0];

3锛岃幏鍙朇aches鐩綍璺緞鐨勬柟娉曪細

NSArray*paths=NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES);

NSString*cachesDir=[pathsobjectAtIndex:0];

4锛岃幏鍙杢mp鐩綍璺緞鐨勬柟娉曪細

NSString*tmpDir=NSTemporaryDirectory();

5锛岃幏鍙栧簲鐢ㄧ▼搴忕▼搴忓寘涓祫婧愭枃浠惰矾寰勭殑鏂规硶锛�

渚嬪鑾峰彇绋嬪簭鍖呬腑涓�涓浘鐗囪祫婧愶紙apple.png锛夎矾寰勭殑鏂规硶锛�

NSString*imagePath=[[NSBundlemainBundle]pathForResource:@鈥漚pple鈥漮fType:@鈥漰ng鈥漖;UIImage*appleImage=[[UIImagealloc]initWithContentsOfFile:imagePath];

浠g爜涓殑mainBundle绫绘柟娉曠敤浜庤繑鍥炰竴涓唬琛ㄥ簲鐢ㄧ▼搴忓寘鐨勫璞°��

鏂囦欢IO鍐欏叆

1锛屽皢鏁版嵁鍐欏埌Documents鐩綍锛�

-(BOOL)writeApplicationData:(NSData*)datatoFile:(NSString*)fileName{

NSArray*paths=

NSUserDomainMask,YES);NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,

NSString*docDir=[pathsobjectAtIndex:0];

if(!docDir){

NSLog(@鈥滵ocumentsdirectorynotfound!鈥�);returnNO;

}

NSString*filePath=[docDirstringByAppendingPathComponent:fileName];

return[datawriteToFile:filePathatomically:YES];

}

2锛屼粠Documents鐩綍璇诲彇鏁版嵁锛�

-(NSData*)applicationDataFromFile:(NSString*)fileName{

NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

NSString*docDir=[pathsobjectAtIndex:0];

NSString*filePath=[docDirstringByAppendingPathComponent:fileName];

NSData*data=[[[NSDataalloc]initWithContentsOfFile:filePath]autorelease];

returndata;

}

NSSearchPathForDirectoriesInDomains杩欎釜涓昏灏辨槸杩斿洖涓�涓粷瀵硅矾寰勭敤鏉ュ瓨鏀炬垜浠渶瑕佸偍瀛樼殑鏂囦欢銆�

-(NSString*)dataFilePath{

NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

NSString*documentsDirectory=[pathsobjectAtIndex:0];

return[documentsDirectorystringByAppendingPathComponent:@"shoppingCar.plist"];}

NSFileManager*fm=[NSFileManagerdefaultManager];

if(![fmfileExistsAtPath:[selfdataFilePath]]){

//涓嬮潰鏄璇ユ枃浠惰繘琛屽埗瀹氳矾寰勭殑淇濆瓨

[fmcreateDirectoryAtPath:[selfdataFilePath]withIntermediateDirectories:YESattributes:nilerror:nil];

//鍙栧緱涓�涓洰褰曚笅寰楁墍鏈夋枃浠跺悕

NSArray*files=[fmsubpathsAtPath:[selfdataFilePath]];

//璇诲彇鏌愪釜鏂囦欢

NSData*data=[fmcontentsAtPath:[selfdataFilePath]];

//鎴栬��

NSData*data=[NSDatadataWithContentOfPath:[selfdataFilePath]];

}

iphone甯歌绉佹湁api鐨勫簲鐢紙姣斿鐩存帴鍙戦�佺煭淇★紝璁块棶娌欑涔嬪鐨勭鐩樻枃浠讹級.

221.鎻忚堪涓�涓媔OS SDK涓浣曞疄鐜癕VC鐨勫紑鍙戞ā寮�

MVC鏄ā鍨嬨�佽鍥俱�佹帶鍒跺櫒寮�鍙戞ā寮忥紝瀵逛簬iOS

SDK锛屾墍鏈夌殑View閮芥槸瑙嗗浘灞傜殑锛屽畠搴旇鐙珛浜庢ā鍨嬪眰锛岀敱瑙嗗浘鍣ㄦ潵鎺у埗銆傛墍鏈夌殑鐢ㄦ埛鏁版嵁閮芥槸妯″瀷灞傦紝瀹冨簲璇ョ嫭绔嬩簬瑙嗗浘銆傛墍鏈夌殑ViewController閮芥槸瑙嗗浘鍣紝鐢卞畠璐熻矗鎺у埗瑙嗗浘锛岃闂ā鍨嬫暟鎹��

222.绠�杩版祬鎷疯礉鍜屾繁鎷疯礉

//娴呮嫹璐濆氨姣斿鍍忓紩鐢ㄧ被鍨嬶紝鑰屾繁鎷疯礉灏辨瘮濡傚�肩被鍨嬨��

娴呮嫹璐濇槸鎸囨簮瀵硅薄涓庢嫹璐濆璞″叡鐢ㄤ竴浠藉疄浣擄紝浠呬粎鏄紩鐢ㄧ殑鍙橀噺涓嶅悓锛堝悕绉颁笉鍚岋級銆傚鍏朵腑浠讳綍涓�涓璞$殑鏀瑰姩閮戒細褰卞搷鍙﹀涓�涓璞°�備妇涓緥瀛愶紝涓�涓汉涓�寮�濮嬪彨寮犱笁锛屽悗鏉ユ敼鍚嶅彨鏉庡洓浜嗭紝鍙槸杩樻槸鍚屼竴涓汉锛屼笉绠℃槸寮犱笁缂鸿兂鑶婂皯鑵胯繕鏄潕鍥涚己鑳宠唺灏戣吙锛岄兘鏄繖涓汉鍊掗湁銆�

娣辨嫹璐濇槸鎸囨簮瀵硅薄涓庢嫹璐濆璞′簰鐩哥嫭绔嬶紝鍏朵腑浠讳綍涓�涓璞$殑鏀瑰姩閮戒笉浼氬鍙﹀涓�涓璞¢�犳垚褰卞搷銆備妇涓緥瀛愶紝涓�涓汉鍚嶅彨寮犱笁锛屽悗鏉ョ敤浠栧厠闅嗭紙鍋囪娉曞緥鍏佽锛変簡鍙﹀涓�涓汉锛屽彨鏉庡洓锛屼笉绠℃槸寮犱笁缂鸿兂鑶婂皯鑵胯繕鏄潕鍥涚己鑳宠唺灏戣吙閮戒笉浼氬奖鍝嶅彟澶栦竴涓汉銆傛瘮杈冨吀鍨嬬殑灏辨槸Value锛堝�硷級瀵硅薄锛屽棰勫畾涔夌被鍨婭nt32锛孌ouble锛屼互鍙婄粨鏋勶紙struct锛夛紝鏋氫妇锛圗num锛夌瓑銆�

C#涓湁涓ょ绫诲瀷鍙橀噺锛屼竴绉嶆槸鍊肩被鍨嬪彉閲忥紝涓�绉嶆槸寮曠敤绫诲瀷鍙橀噺銆傚浜庡墠鑰咃紝copy鏄睘浜庡叏鐩樺鍒讹紱鑰屽浜庡悗鑰咃紝涓�鑸殑copy鍙槸娴卌opy锛岀浉褰撲簬鍙紶閫掍竴涓紩鐢ㄦ寚閽堜竴鏍枫�傚洜姝ゅ浜庡悗鑰呰繘琛岀湡姝opy鐨勬椂鍊欙紝涔熸槸鏈�璐逛簨鐨勶紝鍏蜂綋鐨勮锛屽繀椤讳负鍏跺疄鐜癐Cloneable鎺ュ彛涓彁渚涚殑Clone鏂规硶銆�

娴呮嫹璐�(褰卞瓙鍏嬮殕):鍙鍒跺璞$殑鍩烘湰绫诲瀷,瀵硅薄绫诲瀷,浠嶅睘浜庡師鏉ョ殑寮曠敤.

娣辨嫹璐�(娣卞害鍏嬮殕):涓嶇揣澶嶅埗瀵硅薄鐨勫熀鏈被,鍚屾椂涔熷鍒跺師瀵硅薄涓殑瀵硅薄.灏辨槸璇村畬鍏ㄦ槸鏂板璞′骇鐢熺殑.

223.鍦╥Phone搴旂敤涓浣曚繚瀛樻暟鎹�

//ios绋嬪簭涓暟鎹暟鎹瓨鍌ㄦ湁涓嬪垪5绉嶆柟寮�

XML灞炴�у垪琛紙plist锛夊綊妗c�丳reference(鍋忓ソ璁剧疆)銆丯SKeyedArchiver褰掓。(NSCoding)銆丼QLite3銆丆ore Data

姣忎釜iOS搴旂敤閮芥湁鑷繁鐨勫簲鐢ㄦ矙鐩�(搴旂敤娌欑洅灏辨槸鏂囦欢绯荤粺鐩綍)锛屼笌鍏朵粬鏂囦欢绯荤粺闅旂銆傚簲鐢ㄧ殑鏁版嵁蹇呴』寰呭湪鑷繁鐨勬矙鐩掗噷锛屽叾浠栧簲鐢ㄤ笉鑳借闂娌欑洅

224.鍋囪鏈変竴涓弻鍚戝惊鐜垪闃燂紝姣忎釜鑺傜偣淇濆瓨浜嗕竴涓嚜鐒舵暟锛岀洰鍓嶅憟10锛�9锛�4锛�11鐨勯槦鍒楋紝浠g爜鍐欏嚭涓�涓悜鍏朵腑鎻掑叆鏁板瓧20鐨勭畻娉�

//娌℃壘鍒�

225.鎻忚堪涓媡ableView cell鐨勯噸鐢ㄦ満鍒�,璋堣皥浣犳槸濡備綍浼樺寲UITableView

//閲嶇敤鏈哄埗绠�鍗曠殑璇存剰鎬濅竴琛屼竴琛岀殑cell閮芥槸鍦ㄥ鐢ㄧ殑锛屾粦鍔╰ableview鐨勬椂鍊欙紝鍒氱寮�瑙嗗浘鐨刢ell浼氳鏀惧埌澶嶇敤姹犱腑锛岀瓑涓嬩竴涓猚ell闇�瑕佹樉绀烘椂锛屼細鍏堢湅澶嶇敤姹犱腑鏈夋病鏈塩ell濡傛灉鏈夌殑鏃跺�欙紝灏变粠澶嶇敤姹犱腑鎷垮嚭鏉ell锛屾病鏈夌殑璇濆氨閲嶆柊鍒涘缓cell

浣跨敤涓嶉�忔槑瑙嗗浘銆�

涓嶉�忔槑鐨勮鍥惧彲浠ユ瀬澶у湴鎻愰珮娓叉煋鐨勯�熷害銆傚洜姝ゅ闈炲繀瑕侊紝鍙互灏唗able cell鍙婂叾瀛愯鍥剧殑opaque灞炴�ц涓篩ES锛堥粯璁ゅ�硷級銆�

鍏朵腑鐨勭壒渚嬪寘鎷儗鏅壊锛屽畠鐨刟lpha鍊煎簲璇ヤ负1锛堜緥濡備笉瑕佷娇鐢╟learColor锛夛紱鍥惧儚鐨刟lpha鍊间篃搴旇涓�1锛屾垨鑰呭湪鐢诲浘鏃惰涓轰笉閫忔槑銆�

涓嶈閲嶅鍒涘缓涓嶅繀瑕佺殑table

cell銆�

鍓嶉潰璇翠簡锛孶ITableView鍙渶瑕佷竴灞忓箷鐨刄ITableViewCell瀵硅薄鍗冲彲銆傚洜姝ゅ湪cell涓嶅彲瑙佹椂锛屽彲浠ュ皢鍏剁紦瀛樿捣鏉ワ紝鑰屽湪闇�瑕佹椂缁х画浣跨敤瀹冨嵆鍙��

鑰孶ITableView涔熸彁渚涗簡杩欑鏈哄埗锛屽彧闇�瑕佺畝鍗曞湴璁剧疆涓�涓猧dentifier鍗冲彲锛�

staticNSString *CellIdentifier = @"xxx"; UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) { cell =[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier] autorelease]; }鍊煎緱涓�鎻愮殑鏄紝cell琚噸鐢ㄦ椂锛屽畠鍐呴儴缁樺埗鐨勫唴瀹瑰苟涓嶄細琚嚜鍔ㄦ竻闄わ紝鍥犳浣犲彲鑳介渶瑕佽皟鐢╯etNeedsDisplayInRect:鎴杝etNeedsDisplay鏂规硶銆�

姝ゅ锛屽湪娣诲姞table cell鐨勬椂鍊欙紝濡傛灉涓嶉渶瑕佸姩鐢绘晥鏋滐紝鏈�濂戒笉瑕佷娇鐢╥nsertRowsAtIndexPaths:withRowAnimation:鏂规硶锛岃�屾槸鐩存帴璋冪敤reloadData鏂规硶銆傚洜涓哄墠鑰呬細瀵规墍鏈塱ndexPaths璋冪敤tableView:cellForRowAtIndexPath:鏂规硶锛屽嵆渚胯cell骞朵笉闇�瑕佹樉绀猴紙涓嶇煡閬撴槸涓嶆槸bug锛夛紝杩欏氨鍙兘鍒涘缓澶ч噺澶氫綑鐨刢ell銆傚嫎璇細鍙槸鍦ㄦā鎷熷櫒涓婃祴璇曞姝わ紝鐪熸満璋冭瘯鏃舵病鏈夎繖绉峛ug銆�

鍑忓皯瑙嗗浘鐨勬暟鐩��

UITableViewCell鍖呭惈浜唗extLabel銆乨etailTextLabel鍜宨mageView绛塿iew锛岃�屼綘杩樺彲浠ヨ嚜瀹氫箟涓�浜涜鍥炬斁鍦ㄥ畠鐨刢ontentView閲屻�傜劧鑰寁iew鏄緢澶х殑瀵硅薄锛屽垱寤哄畠浼氭秷鑰楄緝澶氳祫婧愶紝骞朵笖涔熷奖鍝嶆覆鏌撶殑鎬ц兘銆�

濡傛灉浣犵殑table

cell鍖呭惈鍥剧墖锛屼笖鏁扮洰杈冨锛屼娇鐢ㄩ粯璁ょ殑UITableViewCell浼氶潪甯稿奖鍝嶆�ц兘銆傚鎬殑鏄紝浣跨敤鑷畾涔夌殑view锛岃�岄潪棰勫畾涔夌殑view锛屾槑鏄句細蹇簺銆�

褰撶劧锛屾渶浣崇殑瑙e喅鍔炴硶杩樻槸缁ф壙UITableViewCell锛屽苟鍦ㄥ叾drawRect:涓嚜琛岀粯鍒讹細

-(void)drawRect:(CGRect)rect { if (image) { [image drawAtPoint:imagePoint];self.image = nil; } else { [placeHolder drawAtPoint:imagePoint]; } [textdrawInRect:textRect withFont:font lineBreakMode:UILineBreakModeTailTruncation];}涓嶈繃杩欐牱涓�鏉ワ紝浣犱細鍙戠幇閫変腑涓�琛屽悗锛岃繖涓猚ell灏卞彉钃濅簡锛屽叾涓殑鍐呭灏辫鎸′綇浜嗐�傛渶绠�鍗曠殑鏂规硶灏辨槸灏哻ell鐨剆electionStyle灞炴�ц涓篣ITableViewCellSelectionStyleNone锛岃繖鏍峰氨涓嶄細琚珮浜簡銆�

姝ゅ杩樺彲浠ュ垱寤篊ALayer锛屽皢鍐呭缁樺埗鍒發ayer涓婏紝鐒跺悗瀵筩ell鐨刢ontentView.layer璋冪敤addSublayer:鏂规硶銆傝繖涓緥瀛愪腑锛宭ayer骞朵笉浼氭樉钁楀奖鍝嶆�ц兘锛屼絾濡傛灉layer閫忔槑锛屾垨鑰呮湁鍦嗚銆佸彉褰㈢瓑鏁堟灉锛屽氨浼氬奖鍝嶅埌缁樺埗閫熷害浜嗐�傝В鍐冲姙娉曞彲鍙傝鍚庨潰鐨勯娓叉煋鍥惧儚銆�

涓嶈鍋氬浣欑殑缁樺埗宸ヤ綔銆�

鍦ㄥ疄鐜癲rawRect:鐨勬椂鍊欙紝瀹冪殑rect鍙傛暟灏辨槸闇�瑕佺粯鍒剁殑鍖哄煙锛岃繖涓尯鍩熶箣澶栫殑涓嶉渶瑕佽繘琛岀粯鍒躲��

渚嬪涓婁緥涓紝灏卞彲浠ョ敤CGRectIntersectsRect銆丆GRectIntersection鎴朇GRectContainsRect鍒ゆ柇鏄惁闇�瑕佺粯鍒秈mage鍜宼ext锛岀劧鍚庡啀璋冪敤缁樺埗鏂规硶銆�

棰勬覆鏌撳浘鍍忋��

浣犱細鍙戠幇鍗充娇鍋氬埌浜嗕笂杩板嚑鐐癸紝褰撴柊鐨勫浘鍍忓嚭鐜版椂锛屼粛鐒朵細鏈夌煭鏆傜殑鍋滈】鐜拌薄銆傝В鍐崇殑鍔炴硶灏辨槸鍦╞itmap context閲屽厛灏嗗叾鐢讳竴閬嶏紝瀵煎嚭鎴怳IImage瀵硅薄锛岀劧鍚庡啀缁樺埗鍒板睆骞曪紝璇︾粏鍋氭硶鍙銆婂埄鐢ㄩ娓叉煋鍔犻�焛OS璁惧鐨勫浘鍍忔樉绀恒��銆�

涓嶈闃诲涓荤嚎绋嬨��

鍋氬埌鍓嶅嚑鐐瑰悗锛屼綘鐨則able

view婊氬姩鏃跺簲璇ヨ冻澶熸祦鐣呬簡锛屼笉杩囦綘浠嶅彲鑳借鐢ㄦ埛鎰熷埌涓嶇埥銆傚父瑙佺殑鐜拌薄灏辨槸鍦ㄦ洿鏂版暟鎹椂锛屾暣涓晫闈㈠崱浣忎笉鍔紝瀹屽叏涓嶅搷搴旂敤鎴疯姹傘��

鍑虹幇杩欑鐜拌薄鐨勫師鍥犲氨鏄富绾跨▼鎵ц浜嗚�楁椂寰堥暱鐨勫嚱鏁版垨鏂规硶锛屽湪鍏舵墽琛屽畬姣曞墠锛屾棤娉曠粯鍒跺睆骞曞拰鍝嶅簲鐢ㄦ埛璇锋眰銆傚叾涓渶甯歌鐨勫氨鏄綉缁滆姹備簡锛屽畠閫氬父閮介渶瑕佽姳璐规暟绉掔殑鏃堕棿锛岃�屼綘涓嶅簲璇ヨ鐢ㄦ埛绛夊緟閭d箞涔呫��

瑙e喅鍔炴硶灏辨槸浣跨敤澶氱嚎绋嬶紝璁╁瓙绾跨▼鍘绘墽琛岃繖浜涘嚱鏁版垨鏂规硶銆傝繖閲岄潰杩樻湁涓�涓闂紝褰撲笅杞界嚎绋嬫暟瓒呰繃2鏃讹紝浼氭樉钁楀奖鍝嶄富绾跨▼鐨勬�ц兘銆傚洜姝ゅ湪浣跨敤ASIHTTPRequest鏃讹紝鍙互鐢ㄤ竴涓狽SOperationQueue鏉ョ淮鎶や笅杞借姹傦紝骞跺皢鍏秏axConcurrentOperationCount璁句负2銆傝�孨SURLRequest鍒欏彲浠ラ厤鍚�GCD鏉ュ疄鐜帮紝鎴栬�呬娇鐢∟SURLConnection鐨剆etDelegateQueue:鏂规硶銆�

褰撶劧锛屽湪涓嶉渶瑕佸搷搴旂敤鎴疯姹傛椂锛屼篃鍙互澧炲姞涓嬭浇绾跨▼鏁帮紝浠ュ姞蹇笅杞介�熷害锛�

-(void)scrollViewDidEndDragging:(UIScrollView *)scrollViewwillDecelerate:(BOOL)decelerate { if (!decelerate) {queue.maxConcurrentOperationCount = 5; } } -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {queue.maxConcurrentOperationCount = 5; } -(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {queue.maxConcurrentOperationCount = 2; }姝ゅ锛岃嚜鍔ㄨ浇鍏ユ洿鏂版暟鎹鐢ㄦ埛鏉ヨ涔熷緢鍙嬪ソ锛岃繖鍑忓皯浜嗙敤鎴风瓑寰呬笅杞界殑鏃堕棿銆備緥濡傛瘡娆¤浇鍏�50鏉′俊鎭紝閭e氨鍙互鍦ㄦ粴鍔ㄥ埌鍊掓暟绗�10鏉′互鍐呮椂锛屽姞杞芥洿澶氫俊鎭細

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if (count - indexPath.row< 10 && !updating) { updating = YES; [self update]; } }// update鏂规硶鑾峰彇鍒扮粨鏋滃悗锛岃缃畊pdating涓篘O杩樻湁涓�鐐硅娉ㄦ剰鐨勫氨鏄綋鍥剧墖涓嬭浇瀹屾垚鍚庯紝濡傛灉cell鏄彲瑙佺殑锛岃繕闇�瑕佹洿鏂板浘鍍忥細

NSArray*indexPaths = [self.tableView indexPathsForVisibleRows];for (NSIndexPath *visibleIndexPathin indexPaths) { if (indexPath == visibleIndexPath) { MyTableViewCell *cell =(MyTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath]; cell.image= image; [cell setNeedsDisplayInRect:imageRect]; break; } }//涔熷彲涓嶉亶鍘嗭紝鐩存帴涓庡ご灏剧浉姣旇緝锛岀湅鏄惁鍦ㄤ腑闂村嵆鍙�傛渶鍚庤繕鏄墠闈㈡墍璇磋繃鐨刬nsertRowsAtIndexPaths:withRowAnimation:鏂规硶锛屾彃鍏ユ柊琛岄渶瑕佸湪涓荤嚎绋嬫墽琛岋紝鑰屼竴娆℃彃鍏ュ緢澶氳鐨勮瘽锛堜緥濡�50琛岋級锛屼細闀挎椂闂撮樆濉炰富绾跨▼銆傝�屾崲鎴恟eloadData鏂规硶鐨勮瘽锛岀灛闂村氨澶勭悊瀹屼簡銆�

226.鍋氳繃IM寮�鍙戜箞,璋堣皥瀵筙MPPFramework鐨勪簡瑙�

//XMPPFramework鏄竴涓狾S X/iOS骞冲彴鐨勫紑婧愰」鐩紝浣跨敤Objective-C瀹炵幇浜哫MPP鍗忚锛圧FC-3920锛夛紝鍚屾椂杩樻彁渚涗簡鐢ㄤ簬璇诲啓XML鐨勫伐鍏凤紝澶уぇ绠�鍖栦簡鍩轰簬XMPP鐨勯�氫俊搴旂敤鐨勫紑鍙戙��

XMPP涓父鐢ㄥ璞′滑

XMPPStream锛歺mpp鍩虹鏈嶅姟绫�

XMPPRoster锛氬ソ鍙嬪垪琛ㄧ被

XMPPRosterCoreDataStorage锛氬ソ鍙嬪垪琛紙鐢ㄦ埛璐﹀彿锛夊湪core

data涓殑鎿嶄綔绫�

XMPPvCardCoreDataStorage锛氬ソ鍙嬪悕鐗囷紙鏄电О锛岀鍚嶏紝鎬у埆锛屽勾榫勭瓑淇℃伅锛夊湪coredata涓殑鎿嶄綔绫�

XMPPvCardTemp锛氬ソ鍙嬪悕鐗囧疄浣撶被锛屼粠鏁版嵁搴撻噷鍙栧嚭鏉ョ殑閮芥槸瀹�

xmppvCardAvatarModule锛氬ソ鍙嬪ご鍍�

XMPPReconnect锛氬鏋滃け鍘昏繛鎺�,鑷姩閲嶈繛

XMPPRoom锛氭彁渚涘鐢ㄦ埛鑱婂ぉ鏀寔

XMPPPubSub锛氬彂甯冭闃�

婧愮爜鍦板潃锛歨ttp://code.google.com/p/xmppframework/锛岀洰鍓嶉渶瑕佷娇鐢╣it鎵嶈兘download鍒版簮鐮併��

227.浣犳槸濡備綍瀹炵幇澶氬睆骞曢�傞厤鐨�

//涓�銆乮OS灞忓箷閫傞厤鍙戝睍鍘嗙▼

璁惧

閫傞厤鎶�鏈�

4鍙婁互鍓嶏紙iPad鏈嚭锛�

鐩存帴鐢ㄤ唬鐮佽绠�

鏈変簡iPad

autoResizing

鏈変笉鍚屽睆骞曠殑iPhone鍚�

autoLayout

鏈夋洿澶氫笉鍚屽睆骞曠殑iPhone鍚�

sizeClass

浜屻�佸悇涓妧鏈殑鐗规��

1銆乤utoLayout

甯垜浠‘瀹氬湪涓嶅悓璁惧銆佷笉鍚岋紙鐖秜iew锛夌幆澧冧笅锛屽悓涓�涓彲瑙嗗崟鍏冩墍搴斿叿鏈夊悎閫傜殑浣嶇疆鍜屽昂瀵�(浠讳綍涓や釜瑙嗗浘鐨勫叧绯婚兘鍙互纭畾)

1. autoLayout鐨勭敤娉曪細

茂鐩存帴寤虹珛绾︽潫鏉′欢

鈥self.viewaddConstraint: [NSLayoutConstraintconstraintWithItem:blueView attribute:NSLayoutAttributeLeftrelatedBy:NSLayoutRelationEqual toItem:redView attribute:NSLayoutAttributeLeftmultiplier:1 constant:0]];

杩欐牱铏界劧浠g爜閲忔瘮杈冨ぇ锛屼絾鏄槸缁濆鍙鐨勫姙娉曪紝涔熸槸浣跨敤autoLayout鏈�鏍规湰鐨勫姙娉曚箣涓�銆�

茂浣跨敤VFL璇█

- (void)viewDidLoad {

[super viewDidLoad];

UIButton *button=[[UIButtonalloc]init];

[button setTitle:@"鐐瑰嚮涓�涓�"forState:UIControlStateNormal];

button.translatesAutoresizingMaskIntoConstraints=NO;

[button setBackgroundColor:[UIColorblackColor]];

[self.view addSubview:button];

NSArray *constraints1=[NSLayoutConstraint

constraintsWithVisualFormat:@"H:|-[button]-|"options:0 metrics:nil

views:NSDictionaryOfVariableBindings(button)];

NSArray *constraints2=[NSLayoutConstraint

constraintsWithVisualFormat:@"V:|-20-[button(==30)]"options:0metrics:nil

views:NSDictionaryOfVariableBindings(button)];

[self.viewaddConstraints:constraints1];

[self.viewaddConstraints:constraints2];

}

茂浣跨敤浣跨敤绗笁鏂瑰簱锛屽锛歁asonry銆乁IView+AutoLayout鈥︹��

autoLayout鐨勫ソ澶勶細

茂浣犲熀鏈笂鍙互涓嶇敤鑰冭檻3.5瀵稿拰4瀵镐互鍙婂嵆灏嗕笂甯傜殑x.x瀵稿睆骞曚笉鍚屽垎杈ㄧ巼鐨勯棶棰橈紝浣犵粓浜庡彲浠ヤ笉鐢ㄥ湪viewDidLoad鏂规硶閲屽垽鏂笉鍚屽垎杈ㄧ巼涓嬶紝涓嶅悓鎺т欢搴旇鏀惧湪鍝噷锛屾垨鑰呴拡瀵逛笉鍚屽垎杈ㄧ巼鍐欎笉鍚岀殑storyboard鍜寈ib锛�

茂浣犲彲浠ユ姏寮冮偅浜涙牴鎹笉鍚屾枃瀛楁潵璁$畻tableViewCell銆乁ILabel楂樺害鐨勪唬鐮佷簡锛屽洜涓篴utolayout浼氬府浣犺嚜鍔ㄨ绠楀ソ锛�

茂濡傛灉浣犵殑甯冨眬鍦ㄦí灞忕珫灞忎笅鍙樺寲涓嶆槸鐗瑰埆澶э紝浣犱笉鐢ㄥ啀涓烘í鐫�绔栫潃鍐欎袱濂椾唬鐮佹垨鑰呭啓涓や釜storyboard/xib浜嗭紱

2.sizeClass

鍦╥OS8涓紝鏂板浜哠ize Classes鐗规�э紝瀹冩槸瀵瑰綋鍓嶆墍鏈塱OS璁惧灏哄鐨勪竴涓娊璞°�傞偅鎴戜滑灏卞彧鎶婂睆骞曠殑瀹藉拰楂樺垎鍒垎鎴愪笁绉嶆儏鍐碉細Compact:绱у噾銆丷egular:瀹芥澗銆丄ny:浠绘剰銆�

杩欐牱瀹藉拰楂樹笁涓変竴鏁村悎锛屼竴鍏�9涓儏鍐点�傚涓嬪浘鎵�绀猴紝閽堝姣忎竴绉嶆儏鍐点�傛垜浠彲浠ュ湪姣忕鎯呭喌涓嬭缃笉鍚岀殑甯冨眬锛堝寘鎷帶浠剁殑绾︽潫锛岀敋鑷虫槸鎺т欢鏄惁鏄剧ず锛�

sizeClass.png

瀵箂izeClass鐨勭悊瑙o細sizeClass鐨勫疄璐ㄦ槸灏唅OS灞忓箷鍒嗘垚浜嗕笉鍚岀殑鎶借薄姒傚康锛岃繖浜涗笉鍚岀殑鎶借薄缁勫悎锛屽搴旂潃涓嶅悓鐨勮澶囧睆骞曘�傛墍浠ワ紝鍒╃敤sizeClass鍙互閽堝鍚屼竴濂桿I锛屾潵閫傞厤鎵�鏈夌殑灞忓箷銆傛敞鎰忥細杩欎簺鎵�鏈夌殑閫傞厤锛岄兘鏄埄鐢╝utoLayout鏉ュ疄鐜扮殑锛宻izeClass鍙槸璐熻矗鎻愪緵涓嶅悓鐨勫睆骞曞昂瀵搞��

228.璋堣皥浣犱簡瑙g殑璁捐妯″紡,浣犵敤杩囧摢浜�,浠栦滑鐨勪紭缂虹偣

//锛堜竴锛変唬鐞嗘ā寮�

搴旂敤鍦烘櫙锛氬綋涓�涓被鐨勬煇浜涘姛鑳介渶瑕佺敱鍒殑绫绘潵瀹炵幇锛屼絾鏄張涓嶇‘瀹氬叿浣撲細鏄摢涓被瀹炵幇銆�

浼樺娍锛氳В鑰﹀悎

鏁忔嵎鍘熷垯锛氬紑鏀�-灏侀棴鍘熷垯

瀹炰緥锛歵ableview鐨勬暟鎹簮delegate锛岄�氳繃鍜宲rotocol鐨勯厤鍚堬紝瀹屾垚濮旀墭璇夋眰銆�

鍒楄〃row涓暟delegate

鑷畾涔夌殑delegate

锛堜簩锛夎瀵熻�呮ā寮�

搴旂敤鍦烘櫙锛氫竴鑸负model灞傚锛宑ontroller鍜寁iew杩涜鐨勯�氱煡鏂瑰紡锛屼笉鍏冲績璋佸幓鎺ユ敹锛屽彧璐熻矗鍙戝竷淇℃伅銆�

浼樺娍锛氳В鑰﹀悎

鏁忔嵎鍘熷垯锛氭帴鍙i殧绂诲師鍒欙紝寮�鏀�-灏侀棴鍘熷垯

瀹炰緥锛歂otification閫氱煡涓績锛屾敞鍐岄�氱煡涓績锛屼换浣曚綅缃彲浠ュ彂閫佹秷鎭紝娉ㄥ唽瑙傚療鑰呯殑瀵硅薄鍙互鎺ユ敹銆�

kvo锛岄敭鍊煎鏀瑰彉閫氱煡鐨勮瀵熻�咃紝骞虫椂鍩烘湰娌$敤杩囥��

锛堜笁锛塎VC妯″紡

搴旂敤鍦烘櫙锛氭槸涓�涓潪甯稿彜鑰佺殑璁捐妯″紡锛岄�氳繃鏁版嵁妯″瀷锛屾帶鍒跺櫒閫昏緫锛岃鍥惧睍绀哄皢搴旂敤绋嬪簭杩涜閫昏緫鍒掑垎銆�

浼樺娍锛氫娇绯荤粺锛屽眰娆℃竻鏅帮紝鑱岃矗鍒嗘槑锛屾槗浜庣淮鎶�

鏁忔嵎鍘熷垯锛氬鎵╁睍寮�鏀�-瀵逛慨鏀瑰皝闂�

瀹炰緥锛歮odel-鍗虫暟鎹ā鍨嬶紝view-瑙嗗浘灞曠ず锛宑ontroller杩涜UI灞曠幇鍜屾暟鎹氦浜掔殑閫昏緫鎺у埗銆�

锛堝洓锛夊崟渚嬫ā寮�

搴旂敤鍦烘櫙锛氱‘淇濈▼搴忚繍琛屾湡鏌愪釜绫伙紝鍙湁涓�浠藉疄渚嬶紝鐢ㄤ簬杩涜璧勬簮鍏变韩鎺у埗銆�

浼樺娍锛氫娇鐢ㄧ畝鍗曪紝寤舵椂姹傚�硷紝鏄撲簬璺ㄦā鍧�

鏁忔嵎鍘熷垯锛氬崟涓�鑱岃矗鍘熷垯

瀹炰緥锛歔UIApplication sharedApplication]銆�

娉ㄦ剰浜嬮」锛氱‘淇濅娇鐢ㄨ�呭彧鑳介�氳繃getInstance鏂规硶鎵嶈兘鑾峰緱锛屽崟渚嬬被鐨勫敮涓�瀹炰緥銆�

java锛孋++涓娇鍏舵病鏈夊叕鏈夋瀯閫犲嚱鏁帮紝绉佹湁鍖栧苟瑕嗙洊鍏舵瀯閫犲嚱鏁般��

object c涓紝閲嶅啓allocWithZone鏂规硶锛屼繚璇佸嵆浣跨敤鎴风敤alloc鏂规硶鐩存帴鍒涘缓鍗曚緥绫荤殑瀹炰緥锛�

杩斿洖鐨勪篃鍙槸姝ゅ崟渚嬬被鐨勫敮涓�闈欐�佸彉閲忋��

锛堜簲锛夌瓥鐣ユā寮�

搴旂敤鍦烘櫙锛氬畾涔夌畻娉曟棌锛屽皝瑁呰捣鏉ワ紝浣夸粬浠箣闂村彲浠ョ浉浜掓浛鎹€��

浼樺娍锛氫娇绠楁硶鐨勫彉鍖栫嫭绔嬩簬浣跨敤绠楁硶鐨勭敤鎴�

鏁忔嵎鍘熷垯锛氭帴鍙i殧绂诲師鍒欙紱澶氱敤缁勫悎锛屽皯鐢ㄧ户鎵匡紱閽堝鎺ュ彛缂栫▼锛岃�岄潪瀹炵幇銆�

瀹炰緥锛氭帓搴忕畻娉曪紝NSArray鐨剆ortedArrayUsingSelector锛涚粡鍏哥殑楦瓙浼氬彨锛屼細椋炴渚嬨��

娉ㄦ剰浜嬮」锛�1锛屽墺绂荤被涓槗浜庡彉鍖栫殑琛屼负锛岄�氳繃缁勫悎鐨勬柟寮忓祵鍏ユ娊璞″熀绫�

2锛屽彉鍖栫殑琛屼负鎶借薄鍩虹被涓猴紝鎵�鏈夊彲鍙樺彉鍖栫殑鐖剁被

3锛岀敤鎴风被鐨勬渶缁堝疄渚嬶紝閫氳繃娉ㄥ叆琛屼负瀹炰緥鐨勬柟寮忥紝璁惧畾鏄撳彉琛屼负

闃叉浜嗙户鎵胯涓烘柟寮忥紝瀵艰嚧鏃犲叧琛屼负姹℃煋瀛愮被銆傚畬鎴愪簡绛栫暐灏佽鍜屽彲鏇挎崲鎬с��

锛堝叚锛夊伐鍘傛ā寮�

搴旂敤鍦烘櫙锛氬伐鍘傛柟寮忓垱寤虹被鐨勫疄渚嬶紝澶氫笌proxy妯″紡閰嶅悎锛屽垱寤哄彲鏇挎崲浠g悊绫汇��

浼樺娍锛氭槗浜庢浛鎹紝闈㈠悜鎶借薄缂栫▼锛宎pplication鍙笌鎶借薄宸ュ巶鍜屾槗鍙樼被鐨勫叡鎬ф娊璞$被鍙戠敓璋冪敤鍏崇郴銆�

鏁忔嵎鍘熷垯锛欴IP渚濊禆鍊掔疆鍘熷垯

瀹炰緥锛氶」鐩儴缃茬幆澧冧腑渚濊禆澶氫釜涓嶅悓绫诲瀷鐨勬暟鎹簱鏃讹紝闇�瑕佷娇鐢ㄥ伐鍘傞厤鍚坧roxy瀹屾垚鏄撶敤鎬ф浛鎹�

娉ㄦ剰浜嬮」锛氶」鐩垵鏈燂紝杞欢缁撴瀯鍜岄渶姹傞兘娌℃湁绋冲畾涓嬫潵鏃讹紝涓嶅缓璁娇鐢ㄦ妯″紡锛屽洜涓哄叾鍔e娍涔熷緢鏄庢樉锛�

澧炲姞浜嗕唬鐮佺殑澶嶆潅搴︼紝澧炲姞浜嗚皟鐢ㄥ眰娆★紝澧炲姞浜嗗唴瀛樿礋鎷呫�傛墍浠ヨ娉ㄦ剰闃叉妯″紡鐨勬互鐢ㄣ��

229.鏁版嵁鎸佷箙鍖栧瓨鍌ㄦ柟妗堟湁鍝簺?

//鍚�223棰�

230.缃戠粶閫氫俊鐢ㄨ繃鍝簺鏂瑰紡?

绛�

1銆佷娇鐢╯ocket鐨勬柟寮忚繘琛岄�氫俊銆�

2銆佷娇鐢╝synsocket绫诲簱杩涜閫氫俊銆�

231.鐜版湁100涓暟瀛楃殑涔卞簭鏁扮粍,璇风敤涓�绉嶆柟娉曞皢瀹冩帓搴�.鍙渶鍐欏嚭杩囩▼灏辫.濡傛灉涔卞簭鏁扮粍閲岀殑鍏冪礌澧炲姞鍒�10000涓�,璇峰啀娆″皢瀹冩帓搴�.

绛�:

int n = array.Length;

for (int i = 0; i < n - 1; i++){

for (int j = 0 ; j > n - i - 1; j++){

if (array[j] > array[j + 1]) {

int temp = array[j ];

array[j] = array[j + 1];

array[j + 1] = temp;

}

}

}

232.鐢ㄤ綘鎿呴暱鐨勮瑷�,鍐欏嚭鑾峰彇褰撳墠绯荤粺鏃堕棿鐨勪唬鐮併��

绛�:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];

[formatter setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"en_US"]];

[formatter setDateFormat:@"yy-MM-dd HH:mm"];

NSString *currentTime = [formatter stringFromDate:[NSDate date]];

NSLog(@"%@",currentTime);

233.璇锋弿杩颁笅鈥滄瀬瀹㈠府SOHO鈥濇槸濡備綍鏇跨▼搴忓憳璧氬埌閽辩殑銆�

绛�:

鏋佸閭OHO鏄嫭绔嬬▼搴忓憳鍏艰亴浠诲姟鍗忓悓骞冲彴锛屼笓涓氭湇鍔$▼搴忓憳锛孖T鎶�鏈殑鍏艰亴锛屼紬鍖呮湇鍔★紝浜ゆ槗鏈嶅姟锛屽吋鑱屾湇鍔★紝甯姪绋嬪簭鍛樿禋閽眑ooip.cncoding.net锛屽蹇��

234.鍐欎竴涓爣鍑嗙殑瀹廙IN,杩欎釜瀹忚緭鍏ヤ袱涓弬鏁板苟杩斿洖杈冨皬鐨勪竴涓�.

绛�

#define MIN(X,Y)((X)>(Y)?(Y):(X))

235.Obj-c鏈夊閲嶇户鎵垮悧?涓嶆槸鐨勮瘽鏈変粈涔堟浛浠f柟娉�?

绛�:

cocoa涓墍鏈夌殑绫婚兘鏄疦SObject鐨勫瓙绫伙紝澶氱户鎵垮湪杩欓噷鏄敤protocol濮旀墭浠g悊鏉ュ疄鐜扮殑銆備綘涓嶇敤鍘昏�冭檻绻佺悙鐨勫缁ф壙锛岃櫄鍩虹被鐨勬蹇点�傚鎬佺壒鎬у湪obj-c涓�氳繃濮旀墭鏉ュ疄鐜般��

236.Static鍏ㄥ眬鍙橀噺涓庢櫘閫氱殑鍏ㄥ眬鍙橀噺鏈変粈涔堝尯鍒�?static灞�閮ㄥ彉閲忓拰鏅�氬眬閮ㄥ彉閲忔湁浠�涔堝尯鍒�?static鍑芥暟涓庢櫘閫氬嚱鏁版湁浠�涔堝尯鍒�?

绛�:

static鍏ㄥ眬鍙橀噺涓庢櫘閫氱殑鍏ㄥ眬鍙橀噺鏈変粈涔堝尯鍒細static鍏ㄥ眬鍙橀噺鍙垵浣垮寲涓�娆★紝闃叉鍦ㄥ叾浠栨枃浠跺崟鍏冧腑琚紩鐢�;

static灞�閮ㄥ彉閲忓拰鏅�氬眬閮ㄥ彉閲忔湁浠�涔堝尯鍒細static灞�閮ㄥ彉閲忓彧琚垵濮嬪寲涓�娆★紝涓嬩竴娆′緷鎹笂涓�娆$粨鏋滃�硷紱

static鍑芥暟涓庢櫘閫氬嚱鏁版湁浠�涔堝尯鍒細static鍑芥暟鍦ㄥ唴瀛樹腑鍙湁涓�浠斤紝鏅�氬嚱鏁板湪姣忎釜琚皟鐢ㄤ腑缁存寔涓�浠芥嫹璐�

237.MVC妯″紡鐨勭悊瑙�

绛�:

MVC锛屽叏绉癕odel锛堟ā鍨嬶級-View锛堣鍥撅級-Controller锛堟帶鍒跺櫒锛夛紝杩欐槸涓�绉嶅紑鍙戞ā寮忥紝浠栫殑濂藉鏄彲浠ュ皢鐣岄潰鍜屼笟鍔¢�昏緫鍒嗙銆�

Model锛堟ā鍨嬶級锛屾槸绋嬪簭鐨勪富浣撻儴鍒嗭紝涓昏鍖呭惈涓氬姟鏁版嵁鍜屼笟鍔¢�昏緫銆傚湪妯″瀷灞傦紝杩樹細娑夊強鍒扮敤鎴峰彂甯冪殑鏈嶅姟锛屽湪鏈嶅姟涓細鏍规嵁涓嶅悓鐨勪笟鍔¢渶姹傦紝鏇存柊涓氬姟妯″瀷涓殑鏁版嵁銆�

View(瑙嗗浘锛夛紝鏄▼搴忓憟鐜扮粰鐢ㄦ埛鐨勯儴鍒嗭紝鏄敤鎴峰拰绋嬪簭浜や簰鐨勬帴鍙o紝鐢ㄦ埛浼氭牴鎹叿浣撶殑涓氬姟闇�姹傦紝鍦╒iew瑙嗗浘灞傝緭鍏ヨ嚜宸辩壒瀹氱殑涓氬姟鏁版嵁锛屽苟閫氳繃鐣岄潰鐨勪簨浠朵氦浜掞紝灏嗗搴旂殑杈撳叆鍙傛暟鎻愪氦缁欏悗鍙版帶鍒跺櫒杩涜澶勭悊銆�

Controller锛堟帶鍒跺櫒锛夛紝Controller鏄敤鏉ュ鐞嗙敤鎴疯緭鍏ユ暟鎹紝宸茬粡鏇存柊涓氬姟妯″瀷鐨勯儴鍒嗐�傛帶鍒跺櫒涓帴鏀朵簡鐢ㄦ埛涓庣晫闈氦浜掓椂浼犻�掕繃鏉ョ殑鏁版嵁锛屽苟鏍规嵁鏁版嵁涓氬姟閫昏緫鏉ユ墽琛屾湇鍔$殑璋冪敤鍜屾洿鏂颁笟鍔℃ā鍨嬬殑鏁版嵁鍜岀姸鎬併��

238.鐢ㄥ彉閲廰缁欏嚭涓嬮潰鐨勫畾涔�

a)涓�涓暣鍨嬫暟锛圓n integer锛�

b)涓�涓寚鍚戞暣鍨嬫暟鐨勬寚閽堬紙A pointer to an integer锛�

c)涓�涓寚鍚戞寚閽堢殑鐨勬寚閽堬紝瀹冩寚鍚戠殑鎸囬拡鏄寚鍚戜竴涓暣鍨嬫暟锛圓 pointer to a pointer to an integer锛�

d)涓�涓湁10涓暣鍨嬫暟鐨勬暟缁勶紙An array of 10 integers锛�

e)涓�涓湁10涓寚閽堢殑鏁扮粍锛岃鎸囬拡鏄寚鍚戜竴涓暣鍨嬫暟鐨勶紙An array of 10 pointers to integers锛�

f)涓�涓寚鍚戞湁10涓暣鍨嬫暟鏁扮粍鐨勬寚閽堬紙A pointer to an array of 10 integers锛�

g)涓�涓寚鍚戝嚱鏁扮殑鎸囬拡锛岃鍑芥暟鏈変竴涓暣鍨嬪弬鏁板苟杩斿洖涓�涓暣鍨嬫暟锛圓 pointer to a function that takes an integer as an argument and returns an integer锛�

h)涓�涓湁10涓寚閽堢殑鏁扮粍锛岃鎸囬拡鎸囧悜涓�涓嚱鏁帮紝璇ュ嚱鏁版湁涓�涓暣鍨嬪弬鏁板苟杩斿洖涓�涓暣鍨嬫暟锛圓n array of ten pointers to functions that take an integer argument and return an integer锛�

绛旀锛�

a) int a; // An integer

b) int *a; // A pointer to an integer

c) int **a; // A pointer to a pointer to an integer

d) int a[10]; // An array of 10 integers

e) int *a[10]; // An array of 10 pointers to integers

f) int (*a)[10]; // A pointer to an array of 10 integers

g) int (*a)(int);

// A pointer to a function a that takes an integer argument and returns an integer

h) int (*a[10])(int);

// An array of 10 pointers to functions that take an integer argument and return an integer

301銆佸湪涓�涓暟缁勪腑瀛樺湪涓�涓囨潯浠ヤ笂鐨勫瓧绗︿覆锛岀幇鍦ㄨ瀵规暟缁勪腑鎵�鏈夊瓧绗︿覆杩涜鎷兼帴鎿嶄綔锛岃鍐欏嚭鎷兼帴鏂规硶锛堣鑰冭檻鍒版�ц兘鍙婂唴瀛樺崰鐢ㄦ儏鍐碉紝ARC妯″紡锛夈��

NSString *string = [arraycomponentsJoinedByString:@","];

302銆佽涓句緥璇存槑浠g悊鍜岄�氱煡涓ょ鏂瑰紡鍒嗗埆閫傚悎鍦ㄤ粈涔堟儏鍐典笅浣跨敤锛�

浠g悊锛氫竴鑸帶浠剁敤鐨勬瘮杈冨锛屽叾瀹炰篃鍙互鐢╞lock瀹炵幇锛屽鏋滃疄鐜扮殑鎺ュ彛姣旇緝澶氱殑璇濓紝寤鸿鐢ㄤ唬鐞嗭紝濡俇ITableview銆�

閫氱煡锛氳繖涓滆タ鏄叏灞�鐨勶紝鑰屼笖鏄悓姝ョ殑锛屽鏋滀綘瑕佸叏灞�鍙戦�佹秷鎭紝骞朵笖鍋氱殑浜嬫儏鏃堕棿涓嶉暱锛屼笉浼氶樆濉炵嚎绋嬬殑璇濓紝寤鸿浣跨敤銆�

303銆佹槸鍚︿娇鐢ㄨ繃SQLite鎴栬�匜MDataBase瀵规暟鎹簱杩涜鎿嶄綔锛屽苟璇曡堪瀵逛簨鍔℃蹇电殑鐞嗚В銆�

FMDatabase鏄疘OS涓璖qlite鏁版嵁搴撴搷浣滅被

304銆佷互涓嬩袱绉岹CD闃熷垪鍒涘缓鏈変粈涔堜笉鍚岋紵

dispatch_queue_t queue = dispatch_queue_create("MyQueue",DISPATCH_QUEUE_SERIAL);

dispatch_queue_t queue =dispatch_queue_create(@鈥淢yQueue", DISPATCH_QUEUE_CONCURRENT);

//鐢熸垚涓�涓覆琛岄槦鍒楋紝闃熷垪涓殑block鎸夌収鍏堣繘鍏堝嚭锛團IFO锛夌殑椤哄簭鍘绘墽琛岋紝瀹為檯涓婁负鍗曠嚎绋嬫墽琛屻�傜涓�涓弬鏁版槸闃熷垪鐨勫悕绉帮紝鍦ㄨ皟璇曠▼搴忔椂浼氶潪甯告湁鐢紝鎵�鏈夊敖閲忎笉瑕侀噸鍚嶄簡銆�

//鐢熸垚涓�涓苟鍙戞墽琛岄槦鍒楋紝block琚垎鍙戝埌澶氫釜绾跨▼鍘绘墽琛�

305銆佽繍琛屼互涓嬩唬鐮佷細鎵撳嵃浠�涔堢粨鏋滐紵涓轰粈涔堬紵

dispatch_queue_t queue =dispatch_queue_create("MyQueue", DISPATCH_QUEUE_SERIAL);

dispatch_apply(3, queue, ^(size_t i) {

NSLog(@"apply loop:%zu", i);

dispatch_apply(3, queue, ^(size_t j) {

NSLog(@"apply loop inside:%zu", j);

});

});

apply loop:0

306銆佺畝鍗曡鏄庝綘瀵筨lock鐨勭悊瑙d互鍙婁娇鐢╞lock鏈変粈涔堝ソ澶勩��

绛�:block鏄璞★紝瀹冨皝瑁呬簡涓�娈典唬鐮侊紝杩欐浠g爜鍙互鍦ㄤ换浣曟椂鍊欐墽琛屻�俠lock鍙互浣滀负鍑芥暟鍙傛暟鎴栬�呭嚱鏁扮殑杩斿洖鍊硷紝鑰屽叾鏈韩鍙堝彲浠ュ甫杈撳叆鍙傛暟鎴栬繑鍥炲�笺�傚畠鍜屼紶缁熺殑鍑芥暟鎸囬拡寰堢被浼硷紝浣嗘槸鏈夊尯鍒細block鏄痠nline鐨勶紝骞朵笖瀹冨灞�閮ㄥ彉閲忔槸鍙鐨勩��

濂藉: Blocks鏇存竻鏅般�傛瘮濡備竴涓獀iewController涓湁澶氫釜寮圭獥浜嬩欢锛孌elegate灏卞緱瀵规瘡涓簨浠惰繘琛屽垽鏂瘑鍒潵婧愩�傝�孊locks灏卞彲浠ュ湪鍒涘缓浜嬩欢鐨勬椂鍊欏尯鍒嗗紑鏉ヤ簡銆傝繖涔熸槸涓轰粈涔堢幇鍦ㄨ嫻鏋淎PI涓秺鏉ヨ秺澶氬湴浣跨敤Blocks鑰屼笉鏄疍elegate銆�

307銆乻etValue锛歠orKey鍜宻etObject锛歠orKey鐨勫尯鍒槸浠�涔堬紵

绛�: 1, setObject锛歠orkey锛氫腑value鏄笉鑳藉涓簄il鐨勶紝涓嶇劧浼氭姤閿欍��

setValue锛歠orKey锛氫腑value鑳藉涓簄il锛屼絾鏄綋value涓簄il鐨勬椂鍊欙紝浼氳嚜鍔ㄨ皟鐢╮emoveObject锛歠orKey鏂规硶

2, setValue锛歠orKey锛氫腑key鐨勫弬鏁板彧鑳藉鏄疦SString绫诲瀷锛岃�宻etObject锛歠orKey锛氱殑鍙互鏄换浣曠被鍨�

308銆乼ry-catch-finally鐨勪綔鐢ㄥ拰浣跨敤鏂规硶銆�

Java:

1锛屼竴涓柟娉曞唴鍙互鏈夊涓猼ry鈥atch鈥inally璇彞鍧楋紝杩樺彲浠ュ郊姝ゅ祵濂楋紝姣斿涓嬮潰杩欎釜鏂规硶锛�

2锛屽鏋滀竴涓湁杩斿洖鍊肩殑鏂规硶鍐呮湁澶氫釜try鈥atch鈥inally璇彞鍧楋紝return璇彞瑕佷箞鍐欏湪浠绘剰涓�涓猼ry鈥atch鍐咃紝瑕佷箞鍐欏湪鏂规硶鐨勬渶鍚庯紝鍚﹀垯缂栬瘧鏃犳硶閫氳繃锛屽鏋渞eturn璇彞鍐欏湪鏂规硶鐨勬渶鍚庯紝閭d箞浠ヤ笂try鈥atch鈥inally璇彞涓殑姣忎竴涓猣inally鍧楀唴鐨勪唬鐮侀兘灏嗕細鎵ц锛�

3锛屾棤璁烘柟娉曞唴鏄惁鍙戠敓寮傚父锛坖vm鍙互澶勭悊鐨勫紓甯革級锛宖inally鍧楀唴鐨勪唬鐮侀兘灏嗕細鎵ц銆�

309銆佽鍐欏嚭鍚屾缃戠粶璇锋眰鍜屽紓姝ョ綉缁滆姹傚嚱鏁般��

绛�:棣栧厛鍦╥os妯℃嫙鍣ㄤ笂鍒涘缓涓�涓猼ext绐楀彛锛堟垜璧峰悕鍙玹ongbu锛夛細

//鍚屾缃戠粶璇锋眰鍑芥暟

//鑾峰彇鍚嶅彨tongbu鏂囨湰妗嗙殑鍐呭

NSString *txt=self.tongbu.text;

//鍒涘缓url瀵硅薄

NSURL *url=[NSURLURLWithString:txt];

//鍒涘缓璇锋眰瀵硅薄

NSURLRequest*req=[NSURLRequest requestWithURL:url];

//鍙戣捣鍚屾锛岃刀鍥炴暟鎹粰data

NSData*data=[NSURLConnection sendSynchronousRequest:req returningResponse:nilerror:nil];

//寮傛缃戠粶璇锋眰

鍦╒iewController.m鏂囦欢涓婄殑- (void)viewDidLoad鏂规硶閲�

NSString*txt2=self.tongbu.text;

//鍒涘缓url瀵硅薄

NSURL *url2=[NSURLURLWithString:txt2];

//鍒涘缓璇锋眰瀵硅薄

NSURLRequest*req2=[NSURLRequest requestWithURL:url2];

//鍙戦�佽姹傚苟寤虹珛涓�涓唬鐞�

[NSURLConnectionconnectionWithRequest:req2 delegate:self];

//鍥犱负浠g悊浜烘槸鑷繁鎵�浠ヨ鑷繁閬靛畧鍗忚

鍗忚鍦╒iewController.h鏂囦欢閲�

@interface ViewController :

UIViewController//鍥犱负浠g悊瀵硅薄鏄璞℃墍浠ヨ鑷繁閬靛畧鍗忚

//鍚屾椂鍒涘缓涓�涓狽SMutableData绫诲瀷鐨勫璞℃潵鎺ヤ粠缃戠粶涓婃帴鏀剁殑鏁版嵁锛屽悓鏃跺垱寤�3涓崗璁柟娉曟潵杩涜鎺ユ敹鏁版嵁

@property(retain,nonatomic)NSMutableData*data;

//鍗忚鏂规硶

//1杩炴帴鎺ユ敹鍝嶅簲锛岃〃绀烘垚鍔熷缓绔嬭繛鎺�

-(void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse *)response{

self.data=[[NSMutableData alloc]init];//鍒涘缓浠g悊瀵硅薄锛屽苟鍒濆鍖栨暟鎹�

}

//2杩炴帴鎺ユ敹鏁版嵁

//褰㈠弬(NSData *)琛ㄧず鎺ユ敹鍒扮殑鏁版嵁

-(void)connection:(NSURLConnection*)connection didReceiveData:(NSData *)data{

[self.data

appendData:data];//鍚慸ata鍙嶅娣诲姞鏁版嵁

}

//3杩炴帴鎴愬姛

-(void)connectionDidFinishLoading:(NSURLConnection*)connection{

NSLog(@"杩炴帴鎴愬姛");

}

310銆佷粠鐢ㄦ埛浣撻獙瑙掑害涓句緥璇存槑鍚屾鍜屽紓姝ャ��

绛�:1.鍚屾鎰忎负鐫�绾跨▼闃诲锛屽湪涓荤嚎绋嬩腑浣跨敤姝ゆ柟娉曚細涓嶅搷搴斾换浣曠敤鎴蜂簨浠躲�傛墍浠ワ紝鍦ㄥ簲鐢ㄧ▼搴忚璁℃椂锛屽ぇ澶氳鐢ㄥ湪涓撻棬鐨勫瓙绾跨▼澧炲姞鐢ㄦ埛浣撻獙锛屾垨鐢ㄥ紓姝ヨ姹備唬鏇裤��

2.寮傛璇锋眰鐨勫ソ澶勬槸涓嶉樆濉炲綋鍓嶇嚎绋嬶紝浣嗙浉瀵逛簬鍚屾璇锋眰鐣ヤ负澶嶆潅锛岃嚦灏戣娣诲姞涓や釜鍥炶皟鏂规硶鏉ヨ幏鍙栧紓姝ヤ簨浠�

绛�:浠庣敤鎴风殑浣撻獙鏉ヨ,寮傛璇锋眰鏁版嵁鐨凙PP姣斿悓姝ヨ姹傜殑APP鎿嶄綔鏇村姞娴佺晠,蹇嵎,

312銆佸0鏄嶯SString绫诲瀷鐨勫睘鎬ф椂锛岀敤copy鍜宻trong鐨勫尯鍒槸浠�涔堬紵

copy淇グ鐨凬SString,鍦ㄥ垵濮嬪寲鏃�,濡傛灉鏉ユ簮鏄疦SMutableString鐨勮瘽,浼氬鏉ユ簮杩涜涓�娆℃繁鎷疯礉,灏嗘潵婧愮殑鍐呭瓨鍦板潃澶嶅埗涓�浠�,杩欐牱,涓や釜瀵硅薄灏变竴鐐瑰叧绯诲氨娌℃湁浜�,鏃犺浣犳�庝箞鎿嶄綔鏉ユ簮,閮戒笉浼氬鑷繁鐨凬SString鏈変换浣曞奖鍝�

313銆佽皥璋圤bject-C鐨勫唴瀛樼鐞嗘柟寮忓強杩囩▼锛�

浠庝竴娈靛唴瀛樿鐢宠涔嬪悗锛屽氨瀛樺湪涓�涓彉閲忕敤浜庝繚瀛樿繖娈靛唴瀛樿浣跨敤鐨勬鏁帮紝鎴戜滑鏆傛椂鎶婂畠绉颁负璁℃暟鍣紝褰撹鏁板櫒鍙樹负0鐨勬椂鍊欙紝閭d箞灏辨槸閲婃斁杩欐鍐呭瓨鐨勬椂鍊欙紝姣斿璇达紝褰撳湪绋嬪簭A閲岄潰涓�娈靛唴瀛樿鎴愬姛鐢宠瀹屾垚涔嬪悗锛岄偅涔堣繖涓鏁板櫒灏变粠0鍙樻垚浜�1锛堟垜浠妸杩欎釜杩囩▼鍙仛alloc锛夌劧鍚庣▼搴廈涔熼渶瑕佷娇鐢ㄨ繖涓唴瀛橈紝閭d箞璁℃暟鍣ㄥ氨浠�1鍙樻垚浜�2锛堟垜浠妸杩欎釜杩囩▼鍙仛retain锛夌揣鎺ョ潃绋嬪簭A涓嶅啀闇�瑕佽繖娈靛唴瀛樹簡锛岄偅涔堢▼搴廇灏辨妸杩欎釜璁℃暟鍣ㄥ噺1锛堟垜浠妸杩欎釜杩囩▼鍙仛release锛夌▼搴廈涔熶笉鍐嶉渶瑕佽繖娈靛唴瀛樼殑鏃跺�欙紝閭d箞涔熸妸璁℃暟鍣ㄥ噺1锛堣繖涓繃绋嬭繕鏄痳elease锛夊綋绯荤粺锛堜篃灏辨槸Foundation锛夊彂鐜拌繖涓鏁板櫒鍙樻垚浜�0锛岄偅涔堝氨浼氳皟鐢ㄥ唴瀛樺洖鏀剁▼搴忔妸杩欐鍐呭瓨鍥炴敹锛堟垜浠妸杩欎釜杩囩▼鍙仛dealloc锛�

314銆乻tatic鍏ㄥ眬鍙橀噺涓庢櫘閫氱殑鍏ㄥ眬鍙橀噺鏈変粈涔堝尯鍒紵static鏅�氬嚱鏁版湁浠�涔堝尯鍒紵

鍏ㄥ眬鍙橀噺(澶栭儴鍙橀噺)鐨勮鏄庝箣鍓嶅啀鍐犱互static灏辨瀯鎴愪簡闈欐�佺殑鍏ㄥ眬鍙橀噺銆傚叏灞�鍙橀噺鏈韩灏辨槸闈欐�佸瓨鍌ㄦ柟寮忥紝闈欐�佸叏灞�鍙橀噺褰撶劧涔熸槸闈欐�佸瓨鍌ㄦ柟寮忋�傝繖涓よ�呭湪瀛樺偍鏂瑰紡涓婂苟鏃犱笉鍚屻�傝繖涓よ�呯殑鍖哄埆铏藉湪浜庨潪闈欐�佸叏灞�鍙橀噺鐨勪綔鐢ㄥ煙鏄暣涓簮绋嬪簭锛屽綋涓�涓簮绋嬪簭鐢卞涓簮鏂囦欢缁勬垚鏃讹紝闈為潤鎬佺殑鍏ㄥ眬鍙橀噺鍦ㄥ悇涓簮鏂囦欢涓兘鏄湁鏁堢殑銆傝�岄潤鎬佸叏灞�鍙橀噺鍒欓檺鍒朵簡鍏朵綔鐢ㄥ煙锛屽嵆鍙湪瀹氫箟璇ュ彉閲忕殑婧愭枃浠跺唴鏈夋晥锛屽湪鍚屼竴婧愮▼搴忕殑鍏跺畠婧愭枃浠朵腑涓嶈兘浣跨敤瀹冦�傜敱浜庨潤鎬佸叏灞�鍙橀噺鐨勪綔鐢ㄥ煙灞�闄愪簬涓�涓簮鏂囦欢鍐咃紝鍙兘涓鸿婧愭枃浠跺唴鐨勫嚱鏁板叕鐢紝鍥犳鍙互閬垮厤鍦ㄥ叾瀹冩簮鏂囦欢涓紩璧烽敊璇�備粠浠ヤ笂鍒嗘瀽鍙互鐪嬪嚭锛屾妸灞�閮ㄥ彉閲忔敼鍙樹负闈欐�佸彉閲忓悗鏄敼鍙樹簡瀹冪殑瀛樺偍鏂瑰紡鍗虫敼鍙樹簡瀹冪殑鐢熷瓨鏈熴�傛妸鍏ㄥ眬鍙橀噺鏀瑰彉涓洪潤鎬佸彉閲忓悗鏄敼鍙樹簡瀹冪殑浣滅敤鍩燂紝闄愬埗浜嗗畠鐨勪娇鐢ㄨ寖鍥淬�俿tatic鍑芥暟涓庢櫘閫氬嚱鏁版湁浠�涔堝尯鍒紵鍙湪褰撳墠婧愭枃浠朵腑浣跨敤鐨勫嚱鏁板簲璇ヨ鏄庝负鍐呴儴鍑芥暟(static)锛屽唴閮ㄥ嚱鏁板簲璇ュ湪

褰撳墠婧愭枃浠朵腑璇存槑鍜屽畾涔夈�傚浜庡彲鍦ㄥ綋鍓嶆簮鏂囦欢浠ュ浣跨敤鐨勫嚱鏁帮紝搴旇鍦ㄤ竴涓ご鏂囦欢涓鏄庯紝瑕佷娇鐢ㄨ繖浜涘嚱鏁扮殑婧愭枃浠惰鍖呭惈杩欎釜澶存枃浠躲��

315銆丱bjective-C鍫嗗拰鏍堢殑鍖哄埆锛�

绛�:绠$悊鏂瑰紡锛氬浜庢爤鏉ヨ锛屾槸鐢辩紪璇戝櫒鑷姩绠$悊锛屾棤闇�鎴戜滑鎵嬪伐鎺у埗锛涘浜庡爢鏉ヨ锛岄噴鏀惧伐浣滅敱绋嬪簭鍛樻帶鍒讹紝瀹规槗浜х敓memory leak銆�

鐢宠澶у皬锛�

鏍堬細鍦╓indows涓�,鏍堟槸鍚戜綆鍦板潃鎵╁睍鐨勬暟鎹粨鏋勶紝鏄竴鍧楄繛缁殑鍐呭瓨鐨勫尯鍩熴�傝繖鍙ヨ瘽鐨勬剰鎬濇槸鏍堥《鐨勫湴鍧�鍜屾爤鐨勬渶澶у閲忔槸绯荤粺棰勫厛瑙勫畾濂界殑锛屽湪WINDOWS涓嬶紝鏍堢殑澶у皬鏄�2M锛堜篃鏈夌殑璇存槸1M锛屾�讳箣鏄竴涓紪璇戞椂灏辩‘瀹氱殑甯告暟锛夛紝濡傛灉鐢宠鐨勭┖闂磋秴杩囨爤鐨勫墿浣欑┖闂存椂锛屽皢鎻愮ずoverflow銆傚洜姝わ紝鑳戒粠鏍堣幏寰楃殑绌洪棿杈冨皬銆�

鍫嗭細鍫嗘槸鍚戦珮鍦板潃鎵╁睍鐨勬暟鎹粨鏋勶紝鏄笉杩炵画鐨勫唴瀛樺尯鍩熴�傝繖鏄敱浜庣郴缁熸槸鐢ㄩ摼琛ㄦ潵瀛樺偍鐨勭┖闂插唴瀛樺湴鍧�鐨勶紝鑷劧鏄笉杩炵画鐨勶紝鑰岄摼琛ㄧ殑閬嶅巻鏂瑰悜鏄敱浣庡湴鍧�鍚戦珮鍦板潃銆傚爢鐨勫ぇ灏忓彈闄愪簬璁$畻鏈虹郴缁熶腑鏈夋晥鐨勮櫄鎷熷唴瀛樸�傜敱姝ゅ彲瑙侊紝鍫嗚幏寰楃殑绌洪棿姣旇緝鐏垫椿锛屼篃姣旇緝澶с��

纰庣墖闂锛氬浜庡爢鏉ヨ锛岄绻佺殑new/delete鍔垮繀浼氶�犳垚鍐呭瓨绌洪棿鐨勪笉杩炵画锛屼粠鑰岄�犳垚澶ч噺鐨勭鐗囷紝浣跨▼搴忔晥鐜囬檷浣庛�傚浜庢爤鏉ヨ锛屽垯涓嶄細瀛樺湪杩欎釜闂锛屽洜涓烘爤鏄厛杩涘悗鍑虹殑闃熷垪锛屼粬浠槸濡傛鐨勪竴涓�瀵瑰簲锛屼互鑷充簬姘歌繙閮戒笉鍙兘鏈変竴涓唴瀛樺潡浠庢爤涓棿寮瑰嚭

鍒嗛厤鏂瑰紡锛氬爢閮芥槸鍔ㄦ�佸垎閰嶇殑锛屾病鏈夐潤鎬佸垎閰嶇殑鍫嗐�傛爤鏈�2绉嶅垎閰嶆柟寮忥細闈欐�佸垎閰嶅拰鍔ㄦ�佸垎閰嶃�傞潤鎬佸垎閰嶆槸缂栬瘧鍣ㄥ畬鎴愮殑锛屾瘮濡傚眬閮ㄥ彉閲忕殑鍒嗛厤銆傚姩鎬佸垎閰嶇敱alloca鍑芥暟杩涜鍒嗛厤锛屼絾鏄爤鐨勫姩鎬佸垎閰嶅拰鍫嗘槸涓嶅悓鐨勶紝浠栫殑鍔ㄦ�佸垎閰嶆槸鐢辩紪璇戝櫒杩涜閲婃斁锛屾棤闇�鎴戜滑鎵嬪伐瀹炵幇銆�

鍒嗛厤鏁堢巼锛氭爤鏄満鍣ㄧ郴缁熸彁渚涚殑鏁版嵁缁撴瀯锛岃绠楁満浼氬湪搴曞眰瀵规爤鎻愪緵鏀寔锛氬垎閰嶄笓闂ㄧ殑瀵勫瓨鍣ㄥ瓨鏀炬爤鐨勫湴鍧�锛屽帇鏍堝嚭鏍堥兘鏈変笓闂ㄧ殑鎸囦护鎵ц锛岃繖灏卞喅瀹氫簡鏍堢殑鏁堢巼姣旇緝楂樸�傚爢鍒欐槸C/C++鍑芥暟搴撴彁渚涚殑锛屽畠鐨勬満鍒舵槸寰堝鏉傜殑銆�

316銆乢_block鍜宊_weak淇グ绗︾殑鍖哄埆鏄粈涔堬紵

绛旓細1锛屽湪MRC鏃朵唬锛宊_block淇グ锛屽彲浠ラ伩鍏嶅惊鐜紩鐢紱ARC鏃朵唬锛宊_block淇グ锛屽悓鏍蜂細寮曡捣寰幆寮曠敤闂锛�

2锛宊_block涓嶇鏄疉RC杩樻槸MRC妯″紡涓嬮兘鍙互浣跨敤锛屽彲浠ヤ慨楗板璞★紝杩樺彲浠ヤ慨楗板熀鏈暟鎹被鍨嬶紱

3锛宊_weak鍙兘鍦ˋRC妯″紡涓嬩娇鐢紝涔熷彧鑳戒慨楗板璞★紝涓嶈兘淇グ鍩烘湰鏁版嵁绫诲瀷锛�

4锛宊_block瀵硅薄鍙互鍦╞lock涓閲嶆柊璧嬪�硷紝__weak涓嶅彲浠ワ紱

317銆佸浣曡В鍐砊ableView鍗¢】鐨勯棶棰橈紵

1.绛旓細浣跨敤涓嶉�忔槑瑙嗗浘銆�

2.涓嶈閲嶅鍒涘缓涓嶅繀瑕佺殑table

cell銆�

3.鍑忓皯瑙嗗浘鐨勬暟鐩��

4.涓嶈鍋氬浣欑殑缁樺埗宸ヤ綔銆�

5.棰勬覆鏌撳浘鍍忋��

6.涓嶈闃诲涓荤嚎绋嬨�傚綋鐒讹紝鍦ㄤ笉闇�瑕佸搷搴旂敤鎴疯姹傛椂锛屼篃鍙互澧炲姞涓嬭浇绾跨▼鏁帮紝浠ュ姞蹇笅杞介�熷害锛�

318銆佺畝瑕佽涓婬ttp閫氫俊鍗忚鐨勫師鐞嗭紝涓嶴ocket鍗忚鐨勫尯鍒湁鍝簺锛�

绛旓細HTTP鍗忚锛氱畝鍗曞璞¤闂崗璁紝瀵瑰簲浜庡簲鐢ㄥ眰锛孒TTP鍗忚鏄熀浜嶵CP杩炴帴鐨�

tcp鍗忚锛氬搴斾簬浼犺緭灞�

ip鍗忚锛氬搴斾簬缃戠粶灞�

TCP/IP鏄紶杈撳眰鍗忚锛屼富瑕佽В鍐虫暟鎹浣曞湪缃戠粶涓紶杈擄紱鑰孒TTP鏄簲鐢ㄥ眰鍗忚锛屼富瑕佽В鍐冲浣曞寘瑁呮暟鎹��

Socket鏄TCP/IP鍗忚鐨勫皝瑁咃紝Socket鏈韩骞朵笉鏄崗璁紝鑰屾槸涓�涓皟鐢ㄦ帴鍙o紙API锛夛紝閫氳繃Socket锛屾墠鑳戒娇鐢═CP/IP鍗忚銆�

http杩炴帴锛歨ttp杩炴帴灏辨槸鎵�璋撶殑鐭繛鎺ワ紝鍗冲鎴风鍚戞湇鍔″櫒绔彂閫佷竴娆¤姹傦紝鏈嶅姟鍣ㄧ鍝嶅簲鍚庤繛鎺ュ嵆浼氭柇鎺夛紱

socket杩炴帴锛歴ocket杩炴帴灏辨槸鎵�璋撶殑闀胯繛鎺ワ紝鐞嗚涓婂鎴风鍜屾湇鍔″櫒绔竴鏃﹀缓绔嬭捣杩炴帴灏嗕笉浼氫富鍔ㄦ柇鎺夛紱浣嗘槸鐢变簬鍚勭鐜鍥犵礌鍙兘浼氭槸杩炴帴鏂紑锛屾瘮濡傝锛氭湇鍔″櫒绔垨瀹㈡埛绔富鏈篸own浜嗭紝缃戠粶鏁呴殰锛屾垨鑰呬袱鑰呬箣闂撮暱鏃堕棿娌℃湁鏁版嵁浼犺緭锛岀綉缁滈槻鐏鍙兘浼氭柇寮�璇ヨ繛鎺ヤ互閲婃斁缃戠粶璧勬簮銆�

319銆丮VC鏄粈涔堬紵鏈変粈涔堢壒鎬э紵浣犺繕鐔熸倝鍝簺璁捐妯″紡锛岃绠�瑕佽鏄庛��

浠栦滑鏈夐噸澶嶇殑

320銆乤utorelease鍜屽瀮鍦惧洖鏀舵満鍒讹紙gc锛夋湁浠�涔堝叧绯伙紵

绛旓細autorelease鍙槸寤惰繜閲婃斁,gc鏄瘡闅斾竴娈垫椂闂磋闂▼搴�,鐪嬫槸鍚︽湁鏃犳寚閽堟寚鍚戠殑瀵硅薄,鑻ユ湁,灏卞皢瀹冨洖鏀躲�備粬浠袱鑰呮病鏈変粈涔堝叧绯汇��

321銆佸亣璁剧被鍚嶄负MyManager鐨勭被鏈変互涓嬪崟渚嬫柟娉曪紝璇峰啓鍑哄崟渚嬫柟娉曠殑瀹炵幇锛�+锛圡yManager *锛塻haredManager锛�

绛�:+ (MyManager*)sharedManager

{

static MyManager *sharedMyManagerInstance = nil;

static dispatch_once_t predicate;

dispatch_once(&predicate, ^{

sharedMyManagerInstance =[[self alloc] init];

});

return sharedMyManagerInstance;

}

322銆佸叏灞�鍙橀噺鍙笉鍙互瀹氫箟鍦ㄥ彲琚涓�.C鏂囦欢鍖呭惈鐨勫ご鏂囦欢涓紵涓轰粈涔堬紵

绛�:鍙互.鍦ㄤ笉閫傜敤static鎴栬�卌onst(闅愬紡static)鎯呭喌涓�,鍙橀噺鐨勫畾涔夊彧鑳藉嚭鐜颁竴娆★紝鍚﹀垯浼氬鑷撮噸澶嶅畾涔夈�備絾鍗村彲浠ュ0鏄庡娆°�傚洜姝ゅ叏灞�鍙橀噺涓嶅彲浠ュ畾涔夊湪澶存枃浠朵腑銆傚洜涓哄綋璇ュご鏂囦欢琚涓猚鏂囦欢鍖呭惈鐨勮瘽锛屼細瀵艰嚧閲嶅瀹氫箟銆傚洜姝や竴鑸仛娉曟槸鍦ㄦ煇涓壒瀹氱殑澶存枃浠朵腑澹版槑锛岃�屽湪鍙﹀涓�涓壒瀹氱殑c鏂囦欢涓畾涔夈�傞渶瑕佷娇鐢ㄥ氨鍖呭惈鍓嶈�呫��

323銆乀CP/IP閫氫俊寤虹珛鐨勮繃绋嬫�庢牱锛岀鍙f湁浠�涔堜綔鐢紵

绛�:鍙戝嚭灏嗗缓绔嬮�氫俊浼氳瘽鐨勭涓�涓暟鎹寘涔嬪墠锛屽彂閫佹柟涓绘満涓婄殑TCP/IP鍗忚鎵ц浠ヤ笅鍥涗釜涓嶅悓鐨勬楠わ細

1.TCP/IP灏嗕富鏈哄悕鎴朜etBIOS鍚嶇О瑙f瀽涓篒P鍦板潃銆�

2.浣跨敤鐩爣IP鍦板潃鍜孖P璺敱琛紝TCP/IP纭畾瑕佷娇鐢ㄧ殑鎺ュ彛鍜屼笅涓�璺冪偣IP鍦板潃銆�

3.瀵逛簬鍏变韩璁块棶鎶�鏈紙渚嬪锛屼互澶綉銆佷护鐗岀幆鍜屽垎甯冨紡鍏夌氦鏁版嵁鎺ュ彛(FDDI)锛変笂鐨勫崟鎾璉P娴侀噺锛屽湴鍧�瑙f瀽鍗忚(ARP)灏嗕笅涓�璺冪偣IP鍦板潃瑙f瀽涓哄獟浣撹闂帶鍒�(MAC)鍦板潃锛堜篃绉颁负鏁版嵁閾炬帴灞傚湴鍧�锛夈��

瀵逛簬浠ュお缃戝拰FDDI涓婄殑澶氭挱IP娴侀噺锛岀洰鏍囧鎾璉P鍦板潃浼氳鏄犲皠鍒扮浉搴旂殑澶氭挱MAC鍦板潃銆傚浜庝护鐗岀幆涓婄殑澶氭挱IP娴侀噺锛屼娇鐢ㄥ姛鑳藉湴鍧�0xC0-00-00-04-00-00銆傚浜庡叡浜闂妧鏈笂鐨勫箍鎾祦閲忥紝MAC鍦板潃浼氳鏄犲皠鍒�0xFF-FF-FF-FF-FF-FF銆�4.涔嬪悗锛孖P鏁版嵁鎶ヤ細琚彂閫佸埌閫氳繃ARP瑙f瀽鐨凪AC鍦板潃銆佸鎾槧灏勬垨MAC绾у箍鎾湴鍧�銆�

缃戠粶璁块棶瑕侀�氳繃涓嶅悓鐨勫崗璁繘琛岋紝鍚勭鍗忚瑕侀�氳繃涓嶅悓鐨勭鍙h繘琛岃闂紝濡�25绔彛鏄偖浠剁鍙o紝3389瓒呯骇缁堢锛堝氨鏄湪椹▼搴忔渶鎯虫墦寮�鐨勭鍙o級锛�8000=鑵捐OICQ鏈嶅姟鍣ㄧ绛夌瓑寰堝寰堝锛岃浣忓父鐢ㄧ殑鍑犱釜灏卞彲浠ヤ簡銆�

绔彛:璇寸櫧浜嗗氨鐩稿綋浜庨棬,姣忎釜闂ㄩ兘瀵瑰簲鐫�鐩稿鐨凾CP/IP

你可能感兴趣的:(iOS闈㈣瘯棰�300+)