在two actionsheet buttons
申请中one modalviewcontroller
和mainviewcontroller
。现在有两个actionsheet
按钮和modalviewcontroller
按钮,我可以为每个按钮dismissviewdidfinish method
-(void)dismissViewDidFinish:(ModalViewController *)controller
{
[self dismissModalViewControllerAnimated:YES];
}
-(void)dismissViewDidFinish:(Devanagari *)controller1;
{
[self dismissViewControllerAnimated:completion];
}
-(void)dismissViewDidFinish:(English *)controller2;
{
[self dismissViewControllerAnimated:YES];
}
如果我在mainviewcontroller上添加这三个方法,我会收到红色警告消息duplicate declaration of method dismissviewdidfinish
。
任何想法如何解决这种情况。
答案 0 :(得分:1)
多个方法不能使用相同的名称。使用单个dismissViewDidFinish:(UIViewController *)viewController
方法,然后检查查看哪个viewController:
- (void)dismissViewDidFinish:(UIViewController *)viewController {
//check to see what kind of class viewController is
//or use tags by setting the viewcontroller.view.tag when creating it
}