当按下按钮时,我想推送一个新视图,我需要将一个NSDictionary
对象传递给 new DetailViewController
,所以方法如下所示:
-(void)displayCourseDetail:(NSDictionary*)dictionary{
self.detailViewController = [[[DetailViewController alloc]init]initWithDictionary:dictionary];
[self presentViewController:detailViewController animated:YES completion:nil];
}
但我不知道如何NSDictionary
通过这个:
[button addTarget:self action:@selector(displayCourseDetail:) forControlEvents:UIControlEventTouchUpInside];
该按钮是在代码中创建的,因为它是动态的。
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
button.frame=CGRectMake(_StartX+day*_ButtonWidthWorkday, _StartY+course*_ButtonHeightNormal, _ButtonWidthWorkday-_ButtonMargin, _ButtonHeightNormal-_ButtonMargin);
NSDictionary
按下按钮时如何将对象传递给特定的视图控制器?