所以我試圖找出我的註冊頁面的想法在Xcode - 是這樣的:http://weswilliams.me/wp-content/uploads/2011/06/IMG_2525-e1307910945329.png文本字段 - iPhone
無論如何,我想不出什麼反對他們正在使用來實現此顯示。它看起來像一個Button上的TextField?如果是這樣,我永遠不會讓文本框位於頂部,它總是落在按鈕後面,從而使其不可見。
任何提示或建議?
所以我試圖找出我的註冊頁面的想法在Xcode - 是這樣的:http://weswilliams.me/wp-content/uploads/2011/06/IMG_2525-e1307910945329.png文本字段 - iPhone
無論如何,我想不出什麼反對他們正在使用來實現此顯示。它看起來像一個Button上的TextField?如果是這樣,我永遠不會讓文本框位於頂部,它總是落在按鈕後面,從而使其不可見。
任何提示或建議?
這不是按鈕上的文本框。實際上它是表格視圖內的文本框。您必須執行以下操作:
嘗試在此之前這個
設置行的表視圖都有數。
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:@"Cell"];
if(cell == nil)
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"] autorelease];
cell.textLabel.text = [[NSArray arrayWithObjects:@"First",@"Second",@"Third",@"Forth",@"Fifth",@"Sixth",@"Seventh",@"Eighth",@"Nineth",@"Tenth",nil]
objectAtIndex:indexPath.row];
if (indexPath.row % 2) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 200, 21)];
textField.placeholder = @"Enter Text";
textField.text = [inputTexts objectAtIndex:indexPath.row/2];
textField.tag = indexPath.row/2;
textField.delegate = self;
cell.accessoryView = textField;
[textField release];
} else
cell.accessoryView = nil;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
或者,你可以看到這個鏈接See this answer on SO
這是一個基本的分組UITableView。閱讀Apple文檔。這方面也有很多教程。
這應該是一個評論 – NAZIK