如何通过segue将数据从一个视图控制器发送到另一个视图控制器?
country = [[NSMutableArray alloc]initWithObjects:@"Afghanistan", @"Albania",
@"Algeria", @"American Samoa", @"Andorra", @"Angola", @"Anguilla", @"Antarctica",
@"Antigua and Barbuda", @"Argentina", @"Armenia", @"Aruba", @"Australia",
@"Austria", @"Azerbaijan", @"Bahamas", @"Bahrain", @"Bangladesh", @"Barbados",
@"Belarus", @"Belgium", @"Belize", @"Benin", @"Bermuda", @"Bhutan", @"Bolivia",
@"Bosnia and Herzegovina", @"Botswana", @"Brazil", nil];
- (IBAction)onContactClick:(id)sender {
//[self performSegueWithIdentifier:@"TableViewController" sender:self];
答案 0 :(得分:1)
使用SMQuickSegue https://github.com/stefanomondino/SMQuickSegue这很简单,按照说明和示例通过cocoapods包含它(或者下载后只需拖动.h和.m文件),在视图控制器中导入文件(扩展SMQuickViewController)如果可以)然后
- (IBAction)onContactClick:(id)sender {
[self performSegueWithIdentifier:@"TableViewController" parameters:@{@"country_array":country];
}
其中country是您的数组,country_array是“下一个”视图控制器中的属性。