iOS開發學習筆記 UITableview

2021-08-26 18:52:51 字數 985 閱讀 8756

1.工程勾選支援arc

2.利用ib拖乙個uitableview並且連線委託

用uitableview實現簡單的文字和顯示

#import @inte***ce viewcontroller : uiviewcontroller @property (strong,nonatomic) iboutlet uitableview *mtableview; @property (strong,nonatomic) nsarray *list; //儲存列表資料 @end

#import "viewcontroller.h" @inte***ce viewcontroller () @end @implementation viewcontroller @synthesize mtableview,list; - (void)viewdidload - (void)viewdidunload - (bool)shouldautorotatetointe***ceorientation:(uiinte***ceorientation)inte***ceorientation //資料來源委託 //tableview一共有多少行資料 - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section //每行資料的內容 - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath nsuinteger row = [indexpath row]; cell.textlabel.text = [list objectatindex:row]; //新增 uiimage *image = [uiimage imagenamed:@"1.png"]; [cell.imageview setimage:image]; return cell; } @end

如有錯誤、疑問或者任何不合理的地方,請指教。謝謝。

iOS開發學習筆記 UIWindow

1.uiwindow概述 1 整個程式中只有乙個uiwindow物件 2 在程式級別上表示螢幕視窗 3 uiwindow是乙個特殊的uiview,也繼承於uiview 2.建立uiwindow物件 以及注釋 uiscreen 硬體螢幕表示類 mainscreen 獲得主螢幕裝置資訊 bounds 螢...

iOS學習筆記(一) ios搭建開發環境

好久就想試水ios開發了,由於開發環境限制,一直侷限於理論和虛擬機器,近來入手了macbook pro,也來嚐嚐鮮,筆者也是現學現總結,如果有不足,請指正。ios開發必備mac os x 另加一部iphone手機,windows作業系統也可以開發,需要安裝虛擬機器,安裝虛擬機器請參考windows ...

iOS開發學習筆記 OC基礎

for int i 0 i items count i for nsstring item in items 快速列舉的限制 如在迴圈體中增加或刪除物件,則不能使用快速列舉,這時只能用for迴圈。nslog函式負責將指定字串輸出到xcode控制台。nslog的實參個數並不確定,但第乙個實參是必須的,...