views:

133

answers:

2

How can I pass the first tableview row data to second detail view row

I use [cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];

or

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

to show up disclosure button in each cells

it can ,I also add actions in

- (void)tableView:(UITableView *)tableViewaccessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{

NSLog(@"disclosure button %@ touched",indexPath.row);   

}

But when I touch the disclosure button I got nothing shows up in console

Than I add actions in

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

// carry Alarm Name text into sub-table-view to look for detail time and text info
NSLog(@"Alarm Name = %@", [alarmName objectAtIndex:indexPath.row]);
NSLog(@"Index Path Raw# = %i", indexPath.row);

// Navigation logic may go here. Create and push another view controller.
AlarmDetailTableViewController *detailViewController = [[AlarmDetailTableViewController alloc] initWithNibName:@"AlarmTableViewController" bundle:[NSBundle mainBundle]];
// ...
// Pass the selected object to the new view controller.

[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
 detailViewController = nil;

}

It can notified on console mode

But I think it always appear the same detail view when I touch any rows in First Level TableView

How to show a new detail view with data from Level one ?

for example

To make the tableView1.row0.text = detail view.title

and show other data under the title

if you need the code I can upload it

my boss said it's not big secret inside...

Thanks a lot

A: 

Ok,if you tapped on accessory button than show another detail view

we need to add a detail view

First create a "new navigation based application",ex FirstView

right click on the class folder and choice "add new File" choice a new view you wanna display

ex I selected a new tableview named "DetailView"

than first go to the DetailView.m go give a section and row numbers

or declare the layout

than back to FirstView.h

add #import DetailView

go to FirstView.m

find this method - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath

and use DetailView sub class to create a new view

add the codes like this

DetailView *detailView =[[DetailView alloc]init];
detailView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.navigationController pushViewController:detailView animated:YES];

you can add any view you want to display

WebberLai
A: 

Perhaps the problem is with your:

- (void)tableView:(UITableView *)tableViewaccessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{

which should be reading:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
Marius
Ah HA ! Perhaps you got it !
WebberLai
The devil's in the details. :) I came here looking for a problem of my own; my call was not triggering either... fortunately (or unfortunately) the problem magically has gone away.
Marius