iphone - how know if uitableview has a selected cell -


i'm developing app , @ point have several uitableview. want know outside delegate methods, action instance, if tableviews have selected cell , one.

i tried use: (nsindexpath *)indexpathforselectedrow doesn't work, because if don't have selected cell [(nsindexpath *) row] returns "0" , not nil

could please give help??

thanks..

your method correct - indexpathforselectedrow indeed returns nil if no cell selected. if try send message nil object , use value returned 0, need test if path value nil or not before trying cell's row it:

nsindexpath *path = [table indexpathforselectedrow]; if (path){    row = [path row];    ... } else{  // no cell selected } 

p.s. nil typecasted 0, in practise same thing.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -