Attempted to scroll the table view to an out-of-bounds row (5) when there are only 5 rows in section 0. Table view: <UITableView: 0x103891400; frame = (0 48; 375 555); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x280a20b70>; backgroundColor = UIExtendedGrayColorSpace 0 1; layer = <CALayer: 0x2804de480>; contentOffset: {0, 0}; contentSize: {375, 280}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <AIComponentKit.ListView: 0x283d5b640>>. Irritants: () Note: You will not see another error reported for 5 seconds.
This is a listview with 5 items. Works perfectly on Android.
With the buttons you can select previous and next items.
The problem is that in the iOs version the highlighted element is one higher that the actually selected item.
I don't have an iPhone so I can't test it. I want to try to fix it. You showed an error when you set SelectionIndex to 5. Was the list in ListView empty then? If not, how many elements did it have?
Yes, he explained it but there is no fix for it. From what I see, indexing is correct, the only problem is when the code wants to highlight the selected element with a color. After this error occurs, can you retrieve the correct index and selected element using the appropriate properties?
@Patryk_F The indexing is correct, but the hightlighting is not, it is one ahead of the index. So, if you ask for the last elelement via the Next button, the app crashes. @Anke's workaround is fine, I will update my real app using it, but it should be fixed I think.
Someone reported a different problem. When we set the listview to display text and images, and create data for the listview using CreateElement, the data is displayed incorrectly. Can you confirm that? Because I'm looking in the code, but I can't find the error that could cause this. Below is an example project. When you open the application, the list is filled from ListData, and when you click the button, it is filled from blocks. After selecting an item from the list, the main and detail values should be displayed.
What seems to happen in your example is that you cannot add new elements that are not just strings in iOS.
You can create an element, but there is no method to add it to the list.
As you know, there is a method to remove an element from a ListView. I think that similarly there should be an add element (at location). Android does not care, but iOS does.
Here is what happens if you press the "load from Blocks" button:
Hmm, but in the sides I don't want to add items to the list, but replace the existing list. After pressing the button, the list created in the designer should be replaced with the one created in the blocks. However, as you can see, both lists are displayed somehow. It seems to me that a dictionary created in blocks using the CreateElement block is detected as a string and not as a dictionary.
As you can see, the dictionary is created as key = value, instead of key:value. I think this is the problem. But ListView should display only one type of data, not two at the same time. Could you test this project again?