0

我对这段代码感到沮丧......

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
    DoctorRecordController *object=[storyboard instantiateViewControllerWithIdentifier:@"DoctorRecord"];##############leaking code
    object.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentViewController:object animated:YES completion:^(void){            
    }];

仪器在上述代码中显示泄漏。我怎样才能消除泄漏?

4

2 回答 2

0

您可能正在您的街区中捕获对象。尝试这个:

object.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:object animated:YES completion:^(void){
    object = nil;
}];

希望这可以帮助。

于 2013-06-10T13:35:43.810 回答
0

通过使用 __block 存储类型修饰符,我们可以使对象可变在此处输入链接描述 http://kmithi.blogspot.de/2012/03/blocks-programming-in-ios.html

于 2013-10-21T20:59:41.727 回答