我的工作我的第一個應用程序,我有點新的Objective-C,我想使它所以當在text field
有人類型,然後按下一個按鈕,將它保存到table view
。有誰知道如何做到這一點或知道任何教程。如何將數據從文本字段保存到tableview?
1
A
回答
0
這是給你一些好的教程..
http://www.appcoda.com/ios-programming-tutorial-create-a-simple-table-view-app/
http://www.codigator.com/tutorials/ios-uitableview-tutorial-for-beginners-part-1/
http://iosmadesimple.blogspot.in/2012/10/adding-uitableview-tutorial.html
編碼愉快。
編輯:
這裏是我爲你做的:
Simple Demo With TextField & TableView
編輯2:
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。
相關問題
- 1. 如何將tableView數據保存到NSUserDefaults?
- 2. 將文本區域保存到mySQL數據庫字段PHP
- 3. 代碼以文本字段的數據保存到數據庫
- 4. 如何將數據從文本保存到dartagridview
- 5. 如何將文本從UITextField保存到SQLite數據庫中?
- 6. 如何將數據從解析保存到本地數據
- 7. 將文本數據保存到數組
- 8. 將文本字段中的新行保存到mysql字段
- 9. 如何在html中保存文本字段中的數據?
- 10. 如何保存核心數據中文本字段的值?
- 11. 如何使用NSUserDefaults保存兩個文本字段的數據?
- 12. JqueryMobile使用保存按鈕保存文本字段數據
- 13. 如何將Django字段(如在字段對象中)保存到數據庫中?
- 14. Sails.js - 如何將模型的字段保存到數據庫中?
- 15. 如何將數據保存到Baqend的JsonObject字段中?
- 16. 將malayalam文本保存到數據庫
- 17. C:將文本文件中的值保存到內存字段
- 18. 如何將文本字段中的數據從LiveCode保存到iOS和Android文件中?
- 19. 如何將html表單數據保存到文本文件中?
- 20. 如何將數據保存到文本文件並檢索
- 21. 如何使用FolderBrowsedialog將文本框數據保存到文件
- 22. 如何將數據保存到Android上的文本文件?
- 23. 如何在不清除文本框的情況下將輸入字段數據保存到文本文件
- 24. 將文本字段數據存儲到字典中快速
- 25. 如何將文本從文本框保存到文件(Tkinter)
- 26. 如何將文本字段輸入自動保存爲utf8編碼的數據?
- 27. 保存在自定義動態文本字段的tableView內容
- 28. 將數據從列表保存到文本文件
- 29. 將文本段落保存到mysql
- 30. 如何從foreach輸入字段將數據保存到codeigniter中的mysql
有沒有什麼辦法,使與多個文本字段和文本框是比上表視圖 – Jacobanks
@JacobBanks不同的看法,檢查是否有新的演示。 –
@JacobBanks,'BaseViewController'是我們用於常用方法的類。請注意。 –