You can prevent the crash from happening by safely unwrapping cell.labelTitle
with an if let
statement.
if let label = cell.labelTitle{
label.text = "This is a title"
}
You will still have to do some debugging to see why you are getting a nil value there though.
More Related Contents:
- Displaying images on another view controller when button is clicked
- How to make a simple collection view with Swift
- UICollectionView – dynamic cell height? [duplicate]
- How to adjust height of UICollectionView to be the height of the content size of the UICollectionView?
- UICollectionView: Animate cell size change on selection
- Dynamic cell width of UICollectionView depending on label width
- ios 8 Swift – TableView with embedded CollectionView
- UICollectionView header dynamic height using Auto Layout
- EXC_BAD_INSTRUCTION When Passing UICollectionView Cell Data to Different ViewController
- Why on Xcode 11, UICollectionViewCell changes size as soon as you scroll (I already set size in sizeForItem AtIndexPath:)?
- How to scroll to a particluar index in collection view in swift
- uicollectionview remove top padding
- Warning: UICollectionViewFlowLayout has cached frame mismatch for index path ‘abc’
- Implicitly unwrapped optional assign in Xcode 8
- #warning: C-style for statement is deprecated and will be removed in a future version of Swift [duplicate]
- Sorting array alphabetically with number
- Close iOS Keyboard by touching anywhere using Swift
- Add placeholder text inside UITextView in Swift?
- Save custom objects into NSUserDefaults [duplicate]
- Global constants file in Swift
- How to set back button text in Swift
- How to present popover properly in iOS 8
- How to remove the default Navigation Bar space in SwiftUI NavigationView
- Invalid Swift Support – Files don’t match
- How to get only images in the camera roll using Photos Framework
- Create a copy of a UIView in Swift
- “No such module ‘Alamofire'” Xcode won’t recognize Alamofire framework
- Accessing variables from another ViewController in Swift
- How to filter Firebase data in Swift?
- Duplicate Symbol Error in NSManagedObject Subclass