iCarousel stop at user picked index

前端 未结 4 1059
春和景丽
春和景丽 2021-01-11 21:28

EDIT :

I\'m making an app like a Slot Machine, i added iCarousel for the slot object. So I have a button that rotates the iCarou

4条回答
  •  清歌不尽
    2021-01-11 21:34

    Why wouldnt you do your tableview idea, take the below routine call:

    [carousel scrollByNumberOfItems:-35 duration:10.7550f];
    

    and put that into another non-action routine, and have the TableView didSelectItemAtIndex method call your new routine, and have your action routine call it.

    -(void)newRoutineToCall:(int)itemsToMove{
        [carousel scrollByNumberOfItems:itemsToMove duration:10.7550f];
    }
    
    -(IBAction) spin {        
        [self newRoutineToCall:-35];
    } 
    

    Then Implement

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
        [self newRoutineToCall:[indexPath row]];
    }
    

提交回复
热议问题