Memory management when adding a UIImageView to another viewController's view from another viewController's view

北慕城南 提交于 2019-12-06 10:47:51

Kind of tough to guess at this, but I'd say it's these lines

    mapImageViewEx = [[UIImageView alloc] init];
    // snipped some code for clarity
    [containerExViewP addSubview:mapImageViewEx];

    containerExView = [[UIView alloc] initWithFrame:frame];
    // snipped some code for clarity
    self.view = containerExView;

These can and should be release after they've been added to the view hierarchy

    [mapImageViewEx release];
    [containerExView release];

unless you are keeping a reference to these intentionally for something not shown in the snippets above.

[containerExViewP addSubview:mapImageViewEx];

after this line use [containerExViewP release];

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!