2016-11-16 47 views
-1

任何人都可以遇到這樣的,靜態的tableview數據不會出現在設備和模擬器

enter image description here

設置靜態的tableview和標籤,但一旦我運行它,沒有的話在出現全空。

這是基本的,但我找不出原因。

預先感謝您:)

+1

你是否實現了tableview委託,數據源與單個單元格標識符,並從故事板進行正確的鏈接? – Tj3n

+0

你有沒有寫過任何代碼。 –

+0

檢入相應視圖控制器映射的故事板。這是你的rootviewcotroller。什麼是設備或模擬器的輸出。 – Vinodh

回答

1

,你將不得不實施tableview delegate and datasource

[self.tableView setDatasSource:self]; 
[self.tableView setDelegate:self]; 

您可以在viewDidLoad其代碼,然後執行以下數據源。

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

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

此外,您不需要再次使用類似的單元格,您可以簡單地重複使用一個單元格,如下所示。

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuseIdentifier"]; 
+0

僅適用於靜態實現:) –

+0

是的靜態實現你必須使用UITableView委託/數據源,即返回一個靜態的'NSInteger'值在'numberOfRowsInSection'中。 –

相關問題