Getting a crash when trying to add a collection view in my custom view

I am getting a crash when I try to add a collection view in my custom view in ios8 while the same code works with ios7.

  UINib *customNib = [UINib nibWithNibName:@"MYVIEW" bundle:nil];
  MYVIEW *recentView = [[customNib instantiateWithOwner:self options:nil] objectAtIndex:0];

 CGRect rect = recentView.frame;
 rect.origin.y = CGRectGetMaxY(collectionViewCampaign.frame)-50;
 [recentView setFrame:rect];
 [self.scrollViewRoot addSubview:recentView];
 [recentView addCollectionView];
 [recentView reloadCollection];

      

INNER MYVIEW CLASS

- (void)addCollectionView
{
  flowLayOut = [[UICollectionViewFlowLayout alloc] init];
[flowLayOut setItemSize:CGSizeMake(200, 320)];
[flowLayOut setScrollDirection:UICollectionViewScrollDirectionHorizontal];
[flowLayOut setMinimumInteritemSpacing:0];
[flowLayOut setMinimumLineSpacing:5];
[flowLayOut setHeaderReferenceSize:CGSizeMake(0.0f, 20.0f)];
[flowLayOut setFooterReferenceSize:CGSizeMake(0.0f, 20.0f)];
[flowLayOut setSectionInset:UIEdgeInsetsMake(0, 20, 0, 20)];


collectionViewCampaign = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 410) collectionViewLayout:flowLayOut];
[collectionViewCampaign setDataSource:self];
[collectionViewCampaign setDelegate:self];
[collectionViewCampaign setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[collectionViewCampaign setBackgroundColor:[UIColor clearColor]];
[collectionViewCampaign setShowsHorizontalScrollIndicator:NO];
[collectionViewCampaign setShowsVerticalScrollIndicator:NO];
[self addSubview:collectionViewCampaign];
[collectionViewCampaign registerNib:[UINib nibWithNibName:@"MYCollectionCell" bundle:nil] forCellWithReuseIdentifier:kCellIdentifire];
}

      

AND I ACCEPT THIS FOLLOWING APPEAL
AND IF I REMOVE THE FOLLOWING LINE ANY SERVICE.

   [self addSubview:collectionViewCampaign];



Thread 1Queue : com.apple.main-thread (serial) 
#0  0x03d769f0 in CFArrayGetValueAtIndex () 
#1  0x0434be03 in TCharStream::CopyBreakIterator(__CFString const*) () 
#2  0x0434bbb6 in TCharStream::FindLineBreak(CFRange, bool, __CFString const*) const () 
#3  0x042da7f9 in TTypesetter::SuggestLineBreak(std::__1::tuple<TLine const*, TCharStream      const*, void const* (*)(__CTRun const*, __CFString const*, void*), void*,   std::__1::shared_ptr<TBidiLevelsProvider>*, unsigned int, unsigned char> const&, long, double,   double, std::__1::function<unsigned char (long)>) () 
#4  0x042da4fb in TTypesetter::SuggestLineBreak(TLine const&, long, double, double) () 
#5  0x042da160 in CTLineSuggestLineBreakWithOffset () 
#6  0x08ccab20 in __NSStringDrawingEngine () 
#7  0x08cc6172 in -[NSString(NSExtendedStringDrawing)   boundingRectWithSize:options:attributes:context:] () 

#8  0x0279addd in -[UILabel _drawTextInRect:baselineCalculationOnly:] () 
#9  0x02799b39 in -[UILabel drawTextInRect:] () 
#10 0x0279bf90 in -[UILabel drawRect:] () 
#11 0x0261edb5 in -[UIView(CALayerDelegate) drawLayer:inContext:] () 
#12 0x015d3659 in -[CALayer drawInContext:] () 
#13 0x015d358f in backing_callback(CGContext*, void*) () 
#14 0x014bb0a8 in CABackingStoreUpdate_ () 
#15 0x015d3527 in ___ZN2CA5Layer8display_Ev_block_invoke () 
#16 0x01607ef4 in x_blame_allocations () 
#17 0x015d338d in CA::Layer::display_() () 
#18 0x015d35de in -[CALayer _display] () 
#19 0x015d2d4e in CA::Layer::display() () 
#20 0x015d35b8 in -[CALayer display] () 
#21 0x015c77ca in CA::Layer::display_if_needed(CA::Transaction*) () 
#22 0x015c7850 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () 
#23 0x01528b1e in CA::Context::commit_transaction(CA::Transaction*) () 
#24 0x01529ee4 in CA::Transaction::commit() () 
#25 0x015ececc in +[CATransaction flush] () 
#26 0x025c178d in _afterCACommitHandler () 
#27 0x03dc7b0e in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ () 
#28 0x03dc7a50 in __CFRunLoopDoObservers () 
#29 0x03dbc30a in __CFRunLoopRun () 
#30 0x03dbbb7b in CFRunLoopRunSpecific () 
#31 0x03dbb9ab in CFRunLoopRunInMode () 
#32 0x05c8d500 in GSEventRunModal () 
#33 0x05c8d33d in GSEventRun () 
#34 0x0259adee in UIApplicationMain () 
#35 0x001383cd in main at /...../main.m:16 
#36 0x063a6ac5 in start ()

      

Please, help.

Thanks in advance.

+3


source to share





All Articles