2013-10-12 47 views

回答

0
+0

有沒有什麼辦法,使與多個文本字段和文本框是比上表視圖 – Jacobanks

+0

@JacobBanks不同的看法,檢查是否有新的演示。 –

+0

@JacobBanks,'BaseViewController'是我們用於常用方法的類。請注意。 –

1

所有你需要做的就是每次你按下按鈕y你會刷新/更新你的tableview。

- (IBAction)buttonPressed:(id)sender { 
NSString *textNameToAdd = yourTextField.text; 
[containerArrayForTableView addObject:textNameToAdd]; 
[myTableView reloadData]; 
} 

// UITABLEVIEW DELEGATES 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
// Return the number of sections. 
return 1; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 
// Return the number of rows in the section. 
// Usually the number of items in your array (the one that holds your list) 
return [containerArrayForTableView count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 
//Where we configure the cell in each row 

static NSString *CellIdentifier = @"Cell"; 
UITableViewCell *cell; 

cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
} 
// Configure the cell... setting the text of our cell's label 
cell.textLabel.text = [containerArrayForTableView objectAtIndex:indexPath.row]; 
return cell; 
} 

如果你有麻煩的UITableView配置參考here

+0

非常感謝,但我真的很新的,當我把這個在我看來controller.mi獲得6個錯誤,我一定要放什麼東西在.H – Jacobanks

+0

去YOUT .H文件中添加的UITableViewDelegate,這樣的事情.. @interface ViewController中:UIViewController的 Bordz

+0

感謝,是全部。 – Jacobanks

相關問題