English 中文(简体)
Push view 控制逻辑错误
原标题:Push view controller logic error

Im wondering if someone can please tell me what am I missing. I got a tableview with two sections, but when I tap onto anything on section 2, content from section 1 cells is loaded. Thanks in advance.

我在这里是我的智慧指数:

    UIViewController *targetViewController = [[views objectAtIndex:indexPath.row]     objectForKey:@"controller"];
   [[self navigationController] pushViewController:targetViewController animated:YES];

if (indexPath.section == 0)
      [partA  objectAtIndex:indexPath.row];
    else 
      [partB objectAtIndex:indexPath.row];

      [targetViewController release];
}
问题回答

在您的<代码>中:didSelectRowAtIndexPath: 页: 1 使用<代码>indexPath.row的阵列,如果您可能也使用indexPath.section作为限定词。 如果不看到更多的观点控制者,我们就难以找到更好的答案。

您可考虑采用以下守则,而不是发言。

UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:indexPath];

由于你没有保留或分配释放,也取消了释放。

但诚实:我不理解你想要做什么。 “载荷”指的是什么? 移到了什么地方?

您的 t,但我的猜测是,你应凌驾于SelectRowAtIndexPath方法之上,并检查甄选小组的所有人:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

{

if ( tableView == _tableView1){

     //Do something
}

else if ( tableView == _tableView2){

     //Do something different
}

else return;




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签