*闈㈣瘯蹇冨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