I am trying to use iCarousel to display a series of items. I wanted to reuse a storyboard UIView for this, so I created a custom class of a UIView. I also created an XIB file for this, and I set up the view to my preference. I then hooked up the outlets of my view to the class. I am now trying to recreate a UIView so I can use it for my carousel. Here is my custom class of UIView:
Here is my code for my Carousel:
func numberOfItemsInCarousel(carousel: iCarousel) -> Int {
return costs.count
}
func carousel(carousel: iCarousel, viewForItemAtIndex index: Int, reusingView view: UIView?) -> UIView {
let rView = ReturnView(frame: CGRectMake(0, 0, 220, 220))
rView.backgroundColor = UIColor.greenColor()
print(rView.deleteBtn)//fatal error: Unexpectedly found nil when unwrapping an optional value
return rView
}
As you can see from my fatal error, delete button does not exist. This is the same with the rest of my elements. None of the subviews appear:
How can I get the subviews to appear on my iCarousel? Thanks for your help.