Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is dealloc called immediately after the instantiation?
    primarykey
    data
    text
    <p>I have a small problem with ARC and dealloc of the BaseViewController class being called after the instantiation inside the loop and I don't know why. What I'm trying to do is basically store all the base view controllers on an array.</p> <pre><code>@interface CategoriesContainerViewController () @property (nonatomic, strong) IBOutlet UIScrollView* scrollView; @property (nonatomic, strong) NSMutableArray* categoriesViews; @end </code></pre> <hr> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Get the categories from a plist NSString* path = [[NSBundle mainBundle] pathForResource:@"categories" ofType:@"plist"]; NSDictionary* dict = [[NSDictionary alloc] initWithContentsOfFile:path]; NSMutableArray* categories = [dict objectForKey:@"Categories"]; NSLog(@"%i", [categories count]); // Setup the scrollview _scrollView.delegate = self; _scrollView.directionalLockEnabled = YES; _scrollView.alwaysBounceVertical = YES; _scrollView.scrollEnabled = YES; CGRect screenRect = [[UIScreen mainScreen] bounds]; // Loop through the categories and create a BaseViewController for each one and // store it in an array for (int i = 0; i &lt; [categories count]; i++) { BaseViewController* categoryView = [[BaseViewController alloc] initWithCategory:[categories objectAtIndex:i]]; CGRect frame = categoryView.view.frame; frame.origin.y = screenRect.size.height * i; categoryView.view.frame = frame; [_scrollView addSubview:categoryView.view]; [_categoriesViews addObject:categoryView]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload