I want that ,if the users taps a button, these tableCell should be added to a new tableView (where you can see your favorites).
I've one class Car
where the content of the cars is synthesized:
#import "Car.h"
@implementation Car
@synthesize name;
@synthesize speed;
@synthesize selected;
@end
The CarsViewController
contains a tableView where you can find each car:
@implementation CarsViewController {
NSArray *cars;
}
@synthesize tableView = _tableView;
- (void)viewDidLoad
{
Car *car1 = [Car new];
car1.name = @"A1";
car1.speed = @"200 km/h";
car1.selected = FALSE;
Car *car2 = [Car new];
car2.name = @"A2";
car2.speed = @"220 km/h";
car2.selected = FALSE;
cars = [NSArray arrayWithObjects:car1, car2, nil];
}
And finally the CarDetailViewController
has the favorite-button.
And if you click on it the cell of these car should be added to a new ViewController (with TableView).
But what should I add to the method of CarDetailViewController
?
- (IBAction)setFAV:(id)sender {
// don't know what to write here
}
Thanks in advance for all your answers.
UPDATE
So here is a little picture which shows how it should work.