ios - Why is a UITableViewCell detailTextLabel optional in Swift whereas the textLabel is not -
i think somehow got different between "?" , "!" in swift language. while working faced made me more confused.
while working tableview found next datatypes in uitableviewcell
textlabel
, detailtextlabel?
my question is: why detailtextlabel?
optional if textlabel may nil too??
the detailtextlabel
optional because can potentially nil. check documentation:
if style doesn’t back upwards detail labels, nil returned. see uitableviewcellstyle descriptions of main label in defined cell styles.
so if table view style doesn't back upwards detail labels accessing detailtextlabel homecoming nil. hence optional.
the textlabel on other hand created if needed hence not optional:)
ios uitableview swift
No comments:
Post a Comment