I have two UITableViewwith a custom cell, the first UITableViewhas an array of strings in UILabeland UIButton.
This is my FirstViewController (first UITableView)

And secondViewController (second UITableView) has only UILabel.
What I'm trying to do is click, for example, in the second cell UIButton“add to the second table” and pass it to the array using NSUserDefaultsthe second view control, and when I click on the first cell UIButton“add to the second table”, it should save the first value and add this value along with it and add it to secondViewController.
( firstViewController), , , , String NSUserDefaults, UITableView:
func add(sender:AnyObject){
NSUserDefaults.standardUserDefaults().setObject(array, forKey: "Array")
}
, :
func add(sender:AnyObject){
NSUserDefaults.standardUserDefaults().setObject(array[sender.tag], forKey: "Array")
}
secondViewController:
if (NSUserDefaults.standardUserDefaults().stringForKey("Array") != nil){
array = NSUserDefaults.standardUserDefaults().objectForKey("Array")! as! NSArray
}