ios - UICollectionView removing selected cells -


i delete selected cels in uicollectionview.

@property (weak, nonatomic) iboutlet uicollectionview *cardtable; @property (strong, nonatomic) nsmutablearray *cardtablearry; // of card , datamodel 

you can paths of them using array

nsarray *indexpaths = [[self cardtable] indexpathsforselecteditems]; 

you can't [[self cardtable] removeobjectsatindexes: indexpaths]; need nsindexset.

is there way convert nsarray *indexpaths nsindexset ore need somting intierly difrend wand

i convert array in nsindexset

[[self cardtablearry] deleteitemsatindexpaths: [[self cardtable] indexpathsforselecteditems]];  

the solution:

- (void) removecardsfromtable: (nsarray *) indexpaths {     nsmutablearray *cards = [[nsmutablearray alloc] init];     (nsinteger selectedloop = 0; selectedloop < 3; selectedloop++) {         nsindexpath *card = [indexpaths objectatindex: selectedloop];         [cards addobject: [[self cardtable] objectatindex: [card item]]];     }     (nsinteger selectedloop = 0; selectedloop < 3; selectedloop++) {         [[self cardtable] removeobject: [cards objectatindex: selectedloop]];     } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -