Question

I'm implementing an iCarousel that should pass information based on selection made to two additional view controllers.

To pass the information I understand that I need to create an NSIndexPath in the prepareForSegue method in the view controller that contains the iCarousel. The problem I'm having is creating an NSIndexPath since the carousel does not have rows.

In a tableview situation I could use the following:

NSIndexPath *path = [self.tableview indexPathForSelectedRow];

Can I simply change "tableview" to "carousel" and use something in place of indexPathForSelectedRow or is it more complicated than that?

Was it helpful?

Solution

As for creating the indexPath object: You can create an indexPath with the

NSIndexPath * indexPath = [NSIndexPath indexPathForRow:itemID inSection:0];

Giving a 0 value to the section index would not matter since, as you point out, there is no section in the carrousel

Finding the index for the itemID, if you use the nicklockwood's iCarousel :

int itemId = [self.myCarroussel currentItemIndex]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top