令人震惊的是,此问题仍未解决(2012 年 9 月 25 日)。在我的多本书和其他有经验的 iOS 开发人员中研究过这个问题。我原以为添加 pushViewController 代码会修复它,但没有解决。如果有人可以帮助我,请告诉我?如果有人知道这个问题的答案,赏金仍然代表这个问题。
我正在尝试在我的应用程序中为 accesoryButtonTappedRowWithIndexPath 方法构建代码,但是当您单击每个单独的披露按钮时,我无法找到如何进入新的 UI 视图窗口。我买了几本书,比如《开始 IOS 5 开发》。在 Table Views 部分中,我看到了一个如何完成的示例,但我似乎无法将其放入我的。这是我现在列出的代码。The message class where I am trying to display a "message" when the disclosure button is selected to prove that it is working is not pulling up. 我看到它可以在书中的代码中访问,但我无法让它在我的工作中工作,所以我可以让它进入下一个视图。任何人都可以帮助我吗?下面的屏幕显示,当您单击表格的单元格时,我的其他方法操作可以正常弹出消息警报。
非常感谢。
- (void)tableView:(UITableView *)tableView
accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
if (NbhoodDetailController == nil)
{
NbhoodDetailController = [[LWWDisclosureDetailController alloc]initWithNibName:@"LWWDisclosureDetail" bundle:nil];
}
NbhoodDetailController.title = @"Getting Neighborhood Details";
NSUInteger row = [indexPath row];
NSString *SelectedNeighborhood = [ListBlocks objectAtIndex:row];
NSString *DetailMessage = [[NSString alloc]
initWithFormat:@"You pressed the button for the Neighborhood %@ to invest in.", SelectedNeighborhood];
NbhoodDetailController.title = SelectedNeighborhood;
NbhoodDetailController.message = DetailMessage;// <-- the "message" class isn't accessible for some reason as well so I can click on the disclosure button and give a message.
以下索引代码处的行单元格:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath//returns instances of the UITableViewCell class rows that have to be populated into the table view.
{
static NSString *NeighborhoodDBListCellIdentifier = @"NeighborhoodDBListCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NeighborhoodDBListCellIdentifier];//as table view cells scroll off the screen, they are placed into a queue of cells available to be reused. So im using those cells for the new rolls that scroll on the screen to assign them to.
if(cell == nil)//in case of no spare reuseable cells we create new ones here. If dequeueReusableCellWithIdentifier doesn't have any to spare.
{
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:NeighborhoodDBListCellIdentifier];
}
//assigning the images for the rows and also the disclosure buttons for each row
UIImage *image = [UIImage imageNamed:@"rowControlsIcon.png"];
cell.imageView.image = image;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
NSUInteger row = [indexPath row];
cell.textLabel.text = [ListBlocks objectAtIndex:row];//the output results of what the cell is goes to the textLabel in the TableViewCell as text. Like "Armour Neighhborhood"
return cell;
}