Ios 按下故事板中的按钮时发出信号Sigabrat
嗨,当我在一个页面中按下按钮连接到另一个视图时,我有一个错误 你能帮帮我吗 提前谢谢 这是我的代码Ios 按下故事板中的按钮时发出信号Sigabrat,ios,xcode,storyboard,Ios,Xcode,Storyboard,嗨,当我在一个页面中按下按钮连接到另一个视图时,我有一个错误 你能帮帮我吗 提前谢谢 这是我的代码 -(void)buttonPressed:(UIButton *)button { NSLog(@"button %u -- frame: %@", button.tag, NSStringFromCGRect(button.frame)); [self performSegueWithIdentifier:@"WeekView" sender:self]; } - (void)prepare
-(void)buttonPressed:(UIButton *)button
{
NSLog(@"button %u -- frame: %@", button.tag, NSStringFromCGRect(button.frame));
[self performSegueWithIdentifier:@"WeekView" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString: @"WeekView"]){
[segue.destinationViewController setTitle:@"WeekView"];
}}
with debugging = Signal Sigabrat start from here
[self performSegueWithIdentifier:@"WeekView" sender:self];
此行中出现此错误
-(void)buttonPressed:(UIButton *)button
{
NSLog(@"button %u -- frame: %@", button.tag, NSStringFromCGRect(button.frame));
[self performSegueWithIdentifier:@"WeekView" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString: @"WeekView"]){
[segue.destinationViewController setTitle:@"WeekView"];
}}
with debugging = Signal Sigabrat start from here
[self performSegueWithIdentifier:@"WeekView" sender:self];
我还可以在Segue中识别WeekView,并使用SHIP+command+K清除但仍有错误在更改属性之前,您必须初始化destinationviewcontroller:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString: @"WeekView"]){
SecondViewController*second=segue.destinationViewController; //You´re missing this line.
second.title=@"WeekView"; // now you can do stuff on your destinationViewController
}}
我希望它能解决问题。您确实在故事板中创建了一个片段吗?