I want to get the value from one class (SearchTableViewController.m) to another class (HistoryTableV
- by ahmet732
#import <UIKit/UIKit.h>
@class SearchDetailViewController;
@interface SearchTableViewController : UITableViewController
<UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>{
IBOutlet UITableView *myTableView;
NSMutableArray *tableData;//will be storing data that will be displayed in table. //Search array den buna aktarma yapcaz ilerde görceksin.
NSMutableArray *searchedData;//will be storing data matching with the search string
UISearchBar *sBar;//search bar
NSMutableArray *searchArray; // It holds the medicines that are shown in tableview
SearchDetailViewController * searchDetailViewController;
NSMutableArray *deneme;
}
@property(nonatomic,retain)UISearchBar *sBar;
@property(nonatomic,retain)IBOutlet UITableView *myTableView;
@property(nonatomic,retain)NSMutableArray *tableData;
@property(nonatomic,retain)NSMutableArray *searchedData;
@property (nonatomic, retain) NSMutableArray *searchArray;
@property (nonatomic, retain) SearchDetailViewController *searchDetailViewController;
@property (nonatomic, copy) NSMutableArray *deneme;
@end
SearchTableViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
// [self.navigationController pushViewController:anotherViewController];
// [anotherViewController release];
**deneme= [[NSMutableArray alloc]init];
deneme=[tableData objectAtIndex:indexPath.row];**
****NSLog(@"my row = %@", deneme);**// I holded one of the selected cells here**
HistoryTableViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
// [self.navigationController pushViewController:anotherViewController];
// [anotherViewController release];
**SearchTableViewController *obj= [[SearchTableViewController alloc]init];**
**NSLog(@"my 2nd row= %@", [obj deneme]); //it prints nil**
}
My project is TabBar. There are two buttons on it- Search and History. I want to display selected items in a table in History tab. But i can not bring the selected item from SearchTableViewController.m to the class (HistoryTableViewController.m)
The problem is : I can hold one of the selected items in an array (named deneme)from table in SearchTableViewController.m but i can not take it to HistoryTableViewController.m.
It prints nil in console screen.... If I can make it visible in History class, I display those selected items on table. Please help me !!!