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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -