我創建了三個場景,每個場景都有一個按鈕和一個標籤,如圖-1所示。 Scene1通過「Show Segue called scene1To2」鏈接到Scene2, ,Scene2通過「Show Segue called scene2To3」鏈接到scene3,最後Scene3通過「Show Segue called scene3To1」鏈接到scene1。prepareForSegue沒有被調用
我想叫「prepareForSegue」在SCENE1按鈕被點擊的時候,所以我寫了下面代碼1部分所示的代碼..
但是當我運行代碼的NSLog消息「的NSLog(@ 「從scene1到2過渡」);「不露面
請讓我知道爲什麼NSLog的消息不表明
代碼1:
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a
//nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)from1To2:(id)sender {
NSLog(@"Hi");
[self performSegueWithIdentifier:@"scene1To2" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue
{
if ([segue.identifier isEqualToString:@"scene1To2"])
{
NSLog(@"transiting from scene1To2");
}
}
@end