//向下个视图传值
#pragma mark - Navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
//你连接的 identifier 的内容
if ([[segue identifier] isEqualToString:@"ChoseMusic"]) {
// 点击行内容
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UITableViewCell* viewCell = [self.tableView cellForRowAtIndexPath:indexPath];
NSString* str = [[viewCell textLabel] text];
NSLog(@"--%@--", str);
// 传值
[[segue destinationViewController] setValue:str forKey:@"TheMusic"];
}
}
试图跳转
UIStoryboard *storyboard = self.storyboard;
//此identifier在storyboard上相应页面对应的设置里填写,必须保持一致
UIViewController *Identifier = [storyboard instantiateViewControllerWithIdentifier:@"ClockListIdentity"];
[self presentViewController:Identifier animated:YES completion:nil];
带navigation的
只能用push(进栈)self.navigationController pushViewController:<#(UIViewController *)#> animated:<#(BOOL)#> //(进入下一视图)
pop (出栈) self.navigationController popToViewController:<#(UIViewController *)#> animated:<#(BOOL)#> //(返回上一视图)