No Longer able to create subclass of iOSCustomTableCell / MobileTableCustomCell

Hi

I have an iOSCustomTableCell subclass in my project which no longer works now as MobileTableCustomCell no longer seem to support subclasses.

Does any one have a suggestion on how I might workaround around this?

Thanks

You need MobileTableCustomCell

https://documentation.xojo.com/api/user_interface/mobile/mobiletablecustomcell.html

Not MobileCustomTableCell

Oop! Typo! I’ve changed the original. It’s the MobileTableCustomCell I meant. Thanks DerkJ

1 Like

So you actually can’t subclass it?
Did you try Insert from the menu to create one?

Ya, well “Insert > Container Control” (I can’t find MobileContainer specifically) and then changing it to a MobileTableCustomCell (I can’t find. When you assign it as a Super, the compiler throws up errors for the Events

Insert container control.
Then go to super, and there is a little arrow to the right of container control that leads to classes which derive from that.
But…

Yes Jeff, you can do It that way or just change the Super name to MobileTableCustomCell after inserting the Container Control. The result I believe is the same, you can’t assign the result as a Super to another MobileTableCustomCell

Drag one from the library directly to the navigator.

Same problem Greg. You can create the MobileTableCustomCell class the three different ways but when you assign the class to the Super of a MobileTableCustomCell, but when you Run, you get the same 4 errors (“You cannot implement a nonexistent event”)

That means you’re implementing an Event Handler for an event that no longer exists. This was common when moving from API 1.0 to API 2.0 before they reverted the events.

Are you perhaps implementing the “Open” or “Close” event from iOSCustomTableCell instead of the “Opening” or “Closing” events from MobileTableCustomCell ?

Hi Tim,

I don’t believe so - I’m using one of the Examples which ship with 2.1 (CustomCellsAndScroll, which looks to me like it’s using API 2.0)

This makes it sound like you upgraded the project from an existing iOS project, which is one of the common ways you can run into this issue.

FWIW I haven’t been able to reproduce your issue.

Yes. This is true, but I then went back to basics to get it working so I could regress the problem; I started with the Example independently of my project

Start with an empty project and try it.

1 Like

Same problem - Here is the project I created, if it helps: Irish Counties Project

Thanks for your help

Very helpful. The error message you are getting isn’t the correct one for what’s going on.

You can subclass MobileTableCustomCell, but you can’t subclass your subclass of MobileTableCustomCell.

I’m assuming this isn’t a feature of the Xojo iOS framework because the IDE is forcing us to create the subclass of MobileTableCustomCell visually. A clever workaround that is possible on Desktop does not seem to be possible here in the iOS framework.

Thanks Tim. Ya, i figured that but hoped it wasn’t the case since i was able to do it previously. Hopefully this will change in the future.

For now, I’m trying to find a way to assign my own properties, etc to a custom cell, but at a loss on how to do it. Looks like I’ll just have to create multiple cells all holding the same properties, etc. :frowning:

Thanks again everyone for taking the time to respond.

It would be better to create a class that represents the data then just populate the cell from that instead of storing data in the cell. If you are storing data you will run into performance issues since iOS likes to only keep references to cells it is displaying by using the table data source interfaces. If you aren’t using that interface large enough tables can have pretty bad performance and make your storage logic more convoluted.

1 Like

Thanks Jason - Yes, I’m aware of the performance issues alright. I just have a generic cell that has a Prompt and Data property which will get/set the label and data field of different custom cel types (Date Picker, Switch, TextField, etc). It was nice and easy to reference in the older version and now I need to do a lot of if/elses. Weird that I can have a super class for a screen and not for a Custom Control though.