Note that there are some explanatory texts on larger screens.

plurals
  1. POUIButton inside UIView inside UIScrollview, ARC issue
    text
    copied!<p>This is an iOS5 and ARC specific question.</p> <p>I was setting up a set of UIViews inside a UIScrollView, each with their own UIButton declared inside the UIView class:</p> <pre><code> IBOutlet UIButton*button; @property(nonatomic,strong) UIButton*button; </code></pre> <p>(I also original had this as a retain instead of strong, but it made no difference)</p> <p>I also synthesize the button and hook it up in IB to:</p> <pre><code> -(IBAction)showArticle:(id)sender; </code></pre> <p>I add them all to the scroll view with a big loop, depending on the type of article:</p> <pre><code> NewsScrollLead*view = [[NewsScrollLead alloc]initWithNibName:@"NewsScrollLead" bundle:nil]; [view.view setFrame:CGRectMake(0, 0, 513, 225)]; [view.titleLabel setText:[newsDict objectForKey:@"title"]]; [view.details setText:[self flattenHTML:[newsDict objectForKey:@"description"]]]; [view.source setText:[newsDict objectForKey:@"author"]]; [view.details setFont:[UIFont fontWithName:@"HelveticaNeue-Condensed" size:14]]; [view.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-BoldCond" size:20]]; [view.source setFont:[UIFont fontWithName:@"HelveticaNeue-Condensed" size:14]]; [self.newsScrollView addSubview:view.view]; </code></pre> <p>This is one example of how a view is created and added to the scroll view.</p> <p>When I try to click on a button, I get an unrecognized selector error from something different each time, not a UIButton. Using NSZombie, the button has been deallocated for some reason.</p> <p>Any ideas? Pre-iOS5 issues of the same type were resolved by retaining the UIButton, or the view it was contained in, but with ARC there is no retain available.</p>
 

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