iphone - Making an assignable grid to segue in xcode -
i need implement grid view of images requires each segment segue view controller /or view.
my parameters:
i need 260 segments: approx 18px x 18px each segment numbered (1-260) , have diffrent (background) image 1 segment must highlighted (a daily square ical) can tap segment segue next view controller
i have looked @ custom tvcells / buttons there more options out there?
thank you
in end opted for:
- linking 1stviewcontroller 2ndviewcontroller in storyboard , naming seque.identifier in attributes.
- creating grid of uibuttons in ib , assigning them individual tags in attributes (1-260 - don't use 0 default).
to change buttons' backgroundimage daily set day-counter integer , in viewdidload of 1stvc coded:
[(uibutton*)[self.view viewwithtag:daycount] setbackgroundimage:[uiimage imagenamed:@"image_day.png"] forstate:uicontrolstatenormal]; as there multiple uibuttons, decided dragging them ibaction in ib long task assinged them programatically using:
-(void) assignbuttons{ [(uibutton*)[self.view viewwithtag:1] addtarget:self action:@selector(buttonclicked:) forcontrolevents:uicontroleventtouchupinside]; [(uibutton*)[self.view viewwithtag:2] addtarget:self action:@selector(buttonclicked:) forcontrolevents:uicontroleventtouchupinside]; } //etc 260 then used performseguewithidentifier: in method:
-(ibaction) buttonclicked:(id)sender{ [self performseguewithidentifier:@"mysegue" sender:self]; }
Comments
Post a Comment