![](/img/trans.png)
[英]How do I get a login screen on an iPhone app (using tabBarController)?
[英]How do I implement a login screen that uses TableView for an iphone application
我想使用TableView在一個很好的分組視圖中表示“用戶名/密碼”文本字段對話框。 我認為最好的情況是為此使用TableView和兩個單元格。
我在實現中迷失了方向...我缺少為此內置的單元格嗎?
查看three20 ,它可能正是您想要的東西。
您可能想要做的是創建一個具有所需文本字段屬性的自定義UITableViewCell
子類。 為您的新細胞類型創建nib文件,並根據需要進行布局。 將“文件的所有者”類設置為UITableViewController類,並創建從“文件的所有者”中的出口(例如“ newCell”)到自定義單元的連接。
然后,當您需要創建一個單元格(在tableView: cellForRowAtIndexPath:
內部)時,可以從筆尖加載它:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Reuse or create cell
MyCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
// load from nib, reference into self.newCell
[[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil];
cell = self.newCell;
self.newCell = nil; // don't need to hang on to the memory
}
return cell;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.