重复声明方法dismissviewdidfinish

时间:2012-03-27 18:35:42

标签: iphone ios

two actionsheet buttons申请中one modalviewcontrollermainviewcontroller。现在有两个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

任何想法如何解决这种情况。

1 个答案:

答案 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
}