私はUIViewControllers
一緒にリンクされている2つを持っています。
最初のものUIViewController
には4つUIButtons
あり、そのすべてが私を2番目のものに連れて行ってくれUIViewController
ます。
ただし、クリックしたボタンによって内容が変わるはずです。これどうやってするの?
私はUIViewControllers
一緒にリンクされている2つを持っています。
最初のものUIViewController
には4つUIButtons
あり、そのすべてが私を2番目のものに連れて行ってくれUIViewController
ます。
ただし、クリックしたボタンによって内容が変わるはずです。これどうやってするの?
各ボタンに一意のタグを付けprepareForSegue:sender:
、クリックしたボタンのタグを確認できる方法を使用して、それに応じてコンテンツを変更します。
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
UIButton *buttonSender = (UIButton *)sender;
NSLog(@"Tag of the button tag selected = %d", buttonSender.tag);
switch (buttonSender.tag) {
case 1:
// Content if button 1 was clicked.
break;
case 2:
// Content if button 2 was clicked.
break;
case 3:
// Content if button 3 was clicked.
break;
case 4:
// Content if button 4 was clicked.
break;
default:
break;
}
}