我甲肝UITableViewCell和UITableView在上的特定行单view.Clicking UITableView,它定位到anotherViewController.But我不能够浏览到otherViewController上点击UITableViewCell.如何可以我这样做?
因为UITableView我使用此代码:
-(void)pushView1:(id)sender{
if(edController == nil)
edController = [[EditableDetailCell alloc] initWithNibName:@"EditableDetailCell" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:edController animated:YES];
}
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UITableViewCell *tbcel;
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
tbcel.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
tbcel.layer.cornerRadius = 15;
tbcel.text = aBook.Name;
switch(indexPath.section)
{
case 0:
cell.text = aBook.Address;
break;
case 1:
cell.text = aBook.Phone;
break;
case 2:
cell.text = aBook.Purchase;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(edController == nil)
edController = [[EditableDetailCell alloc] initWithNibName:@"EditableDetailCell" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:edController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

我应该怎么做UITableViewCell?

编辑:
你想要推送的不是 UITableViewCell
这是另一种景色。
你可以说
YourCustomView *view = [[YourCustomView alloc] init];
[self.navigationController pushViewController:view animated:Yes];
Run Code Online (Sandbox Code Playgroud)
但我从未看到任何代码传递到另一个单元格。
单元格用于自定义 UITableView 的外观。
添加:
我认为 if 语句在这里没有用。
你的意思是
if(edController == nil){
edController = [[EditableDetailCell alloc] initWithnibName:@"EditableDetailCell" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:edController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
否则无论如何都会传递一个空视图。
| 归档时间: |
|
| 查看次数: |
8862 次 |
| 最近记录: |