I have the following question.
Lets say i have a UIViewController Class named "ModuleViewController" which contains multiple dynamically created UIButtons and multiple dynamically created Mpmovieplayercontrollers. Each of these objects have their Callback functions, contained in the "ModuleViewController" Class. One Call Back for all the UIButtons and one for all The Mpmovieplayercontrollers.
Now i want to add multiple "ModuleViewController" Class instances inside a UIScrollview. I do not use ARC. If i release these objects after i allocate them and initialize them inside my "ModuleViewController" Class, the Buttons and the Videos do not play or rhe Application Crashs.
Currently my solution is to have an NSMutableArray to store their pointers when they are created, and then release them when i release the "ModuleViewController" Class at a later state. (e.x. Release the "ModuleViewController" Class when it is off screen from the viewport of the UIScrollview)
For example. If my array which holds the pointers is "objectsRetained"
// Creating the Array of fPointers on ViewDidLoad
NSMutableArray *objectsRetained = [[NSMutableArray alloc] init];
. . // Add Object Pointer inside the array to release it at later state
[objectsRetained addObject:[NSValue valueWithPointer: myObject]];
This solutions works but when i analyze my application, it shows that there is a posible Memory Leak in this area.
Is there another way to solve this?