ios - How to instantiate UITableViewCell with custom class in switch section -


I need to create an object at the beginning of the cellForRowAtIndexPath switch section: < Pre> switch (indexPath.section) {case detailControllerAddressSection: {NSString * address = [auto address text]; UITableViewCell * cell; If (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPad) {if (IS_OS_7_OR_LATER) {cell = (CustomDetailCell *) [tableView dequeueReusableCellWithIdentifier: @ "AddressCell" forIndexPath: indexPath]; Cell.mainLabel.text = Address; Cell.detailLabel.text = [Object data for Self Distance Message: self.objectData]; } Else {UniversalAddressCell * cell = (UniversalAddressCell *) [Talikadrishy dequeueReusableCellWithIdentifier: @ "UniversalAddressCell" forIndexPath: indexPath]; Cell.backgroundView = [Self cell backgroundground view: indexing path]; Cell.mainLabel.text = Address; ...

But in this case the cell is UITableViewCell and I can not get labels from the CustomDetailCell class. How to solve it? This decision is simple, but I believe how to solve it.

The problem is UITableViewCell * cell;

Even if you put the cell as (CustomDetailCell *) storage type still UITableViewCell

What you can do:

  switch (indexPath.section) {case detailControllerAddressSection: {NSString * address = [auto address text]; UITableViewCell * cell; If (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPad) {if (IS_OS_7_OR_LATER) {CustomDetailCell * detailCell = (CustomDetailCell *) [tableView dequeueReusableCellWithIdentifier: @ "AddressCell" forIndexPath: indexPath]; DetailCell.mainLabel.text = Address; DetailCell.detailLabel.text = [Object data for self-distance message: self.objectData]; Cell = expansion; } Else {Universladdraessil * Universlsel = (Universladdraessil *) [Tblaviav Dekveuereuslekelvithidentifiar: @ "Universladdraessil" Forindekspat: Indekspat]; UniversalCell.backgroundView = [Self cell backgroundgroundviewview: indexpath]; UniversalCell.mainLabel.text = Address; Cell = universal cell;    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -