IOS - Segue - detect which image was clicked -


i working on ios. using images instead of buttons.there segue between 1 controller another. depending on image has been clicked want load specific information in secondcontroller. want know possible detect image has been tapped , pass image name or title or whatever can detect controller using segue.the other way 2 have transparent buttons on images , tag value. want know if somehow can detect image clicked why go code.

   -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender    {         nsinteger tagindex = [(uibutton *)sender tag];    if (([segue.identifier isequaltostring:@"rightimagesegue"]))      {          secondviewcontroller *destviewcontroller = segue.destinationviewcontroller;         [destviewcontroller setselectedbutton:tagindex];      }    } 

there couple of ways this. first of all, uibuttons can have background image, set various images. if you're intent on using uiimageview, have implement touch event receiving method , handle yourself. either way, can use performseguewithidentifier:.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -