开发者

how to remove subview from app delegate?

i have one function in app delegate 开发者_如何学Pythonthe function has code in appdelegate.m

        OthersController *mm_OthersController = [[OthersController alloc] init];


        [mm_OthersController toggle_OF: mm_OthersController];
         [mm_OthersController release]; 

the toggle_OF function is in OthersController.m file which has been set in IB for tab bar item...

-(void)toggle_OF:(OthersController *)con
 {

[con.toolbar removeFromSuperview];
}

the break point goes perfectly...but tool bar cannot be removed......this function is called perfectly if i call within the OthersController.m


You can simplify things first and check if it then works;

OthersController *mm_OthersController = [[OthersController alloc] init];

[mm_OthersController toggle_OF];
[mm_OthersController release];

You don't have to give the parameter if using the function from inside the controller

-(void)toggle_OF
{
    [self.toolbar removeFromSuperview];
}

Probably will not solve your entire problem, but makes the code a bit cleaner.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜