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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -