Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS w/ storyboards & ARC: Controller property not initialized
    primarykey
    data
    text
    <p>The problem is simple to explain but difficult for me to resolve. I have a property that is NEVER initialized.</p> <p>First of all, I'm using the iCarousel custom class in order to display some images for my app. In one of its delegate methods (the one that it uses in order to know which view is going to show at some index), I use this code:</p> <pre><code>- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view { if(!view) { CustomController* controller = [self.storyboard instantiateViewControllerWithIdentifier: "identifier"]; //BTW, the CustomController is initialized properly. Its instance is not nil after the initialization. controller.imageView.image = [UIImage imageNamed: "something.png"]; view = controller.view; } return view; } </code></pre> <p>As you can see, the view that I show in my carousel is a custom view with its own controller. I initialize it using the storyboard method and then I just set the image in my imageView property, which is, obviously, an UIImageView.</p> <p>Don't get excited and say that I'm not initializing my imageView, because I have a custom getter in my "CustomController" class. Like this:</p> <p>//interface (.h)</p> <pre><code>... @property (nonatomic, strong) UIImageView* imageView; ... </code></pre> <p>//implementation (.m)</p> <pre><code>... @synthesize imageView = _imageView; ... - (UIImageView*) imageView { if(!_imageView) _imageView = [[UIImageView alloc] init]; return _imageView; } ... </code></pre> <p>Believe it or not, even if I put a breakpoint in the "_imageView = [[UIImageVIew alloc] init];"... the program executes that line but the _imageView remains nil. ¿Why?</p> <p>I don't want to know "How to set my property", so please don't give workarounds for this... what I want to know is "Why my property is never setted and remains nil always", what's am I doing wrong?.</p> <p>I've also tried to use my imageView as an IBOutlet... but even if I link it to an imageView in the Interface Builder and check its value after the "viewDidLoad", it still remains nil.</p> <p>P.S: Btw, I'm using ARC (yeah, I know is in the title... xD)</p>
    singulars
    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