how can i compare the index in iPhone -
i have taken indexes of array shown in tableview , want play @ didselectrowatindexpath
same in index.
mpmediaitem *item = [arranand objectatindex:3]; nsurl *url = [item valueforproperty:mpmediaitempropertyasseturl]; avplayeritem *playeritem = [[avplayeritem alloc] initwithurl:url]; player2 = [[avplayer alloc] initwithplayeritem:playeritem]; [player2 play];
here have pass 3 ..but need index match select @ did select row
help!!
the tableview:didselectrowatindexpath:
pass indexpath object, contains index of selected table cell:
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { mpmediaitem *item = [arranand objectatindex:indexpath.row]; nsurl *url = [item valueforproperty:mpmediaitempropertyasseturl]; avplayeritem *playeritem = [[avplayeritem alloc] initwithurl:url]; player2 = [[avplayer alloc] initwithplayeritem:playeritem]; [player2 play]; }
the indexpath.row
give direct index if not have sections in tableview.
Comments
Post a Comment