ios - the behavior of the UICollectionViewFlowLayout is not defined -


i've been trying recreate, sample project given here.

i've created , updated bridging-header file , working on viewcontroller.swift use libraries.

code myviewcontroller.swift:

import uikit  class continueviewcontroller: uiviewcontroller, uicollectionviewdatasource, uicollectionviewdelegate {  override func viewdidload() {   }  func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int {     return 1; }  func numberofsectionsincollectionview(collectionview: uicollectionview) -> int {     return 4; }  func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell {     //var cell = rgcollectionviewcell()      let cell = collectionview.dequeuereusablecellwithreuseidentifier("reuse", forindexpath: indexpath) as! rgcollectionviewcell     self.configurecell(cell, withindexpath: indexpath)      return cell; }  func configurecell(cell: rgcollectionviewcell!, withindexpath indexpath: nsindexpath!) {     let subview = (cell.contentview .viewwithtag(99)) uiview!     subview.removefromsuperview()      switch (indexpath.section)     {     case 0:         cell.imageview.image =  uiimage(named: "i1")         cell.mainlabel.text = "glaciers";         break;     case 1:         cell.imageview.image =  uiimage(named: "i2")         cell.mainlabel.text = "parrots";         break;     case 2:         cell.imageview.image =  uiimage(named: "i3")         cell.mainlabel.text = "whales";         break;     case 3:         cell.imageview.image =  uiimage(named: "i4")         cell.mainlabel.text = "lake view";         break;     case 4:         cell.imageview.image =  uiimage(named: "i5")         break;     default:         break;     }   }  } 

and i've created same story board elements , linked them up.

but when build project, build succeeds when opens in ios simulator, crashes , console window states,

2015-04-26 11:20:45.699  behavior of uicollectionviewflowlayout not defined because: 2015-04-26 11:20:45.700 item width must less width of uicollectionview minus section insets left , right values.  fatal error: unexpectedly found nil while unwrapping optional value 

with debug navigator pointing line,

subview.removefromsuperview() 

with exc_bad_instruction(code=exc_i386_invop, subcode=0x0) highlighted.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -