我使用單個視圖中創建一個應用程序based.Now我必須顯示15號有關每個menu.So菜單和描述的我想用UITableView
在that.While選擇插入的細胞應該顯示長文本&圖像content.Do我要創建每個ViewController
每個類別或任何快捷方式添加描述編程 這裏是我的表視圖代碼如何創建的UITableView和細節視圖分別
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:15];
cell.textLabel.text = [NSString stringWithFormat:@"Cell Row #%d", [indexPath row]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// open a alert with an OK and cancel button
NSString *alertString = [NSString stringWithFormat:@"Clicked on row #%d", [indexPath row]];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:alertString message:@"" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil];
[alert show];
[alert release];
}
這是創建UIAlertView
當細胞感動。
我怎樣才能長文本和圖像display.Any想法請做。
這將取決於你想顯示那些15個視圖控制器以及所涉及的複雜的內容。 – rishi 2012-07-12 06:58:17
關於詳細視圖,你可以得到點擊索引,他們可以顯示其詳細視圖! – NSException 2012-07-12 07:24:32