ios - Two Panels on the Right Using SWRevealViewController -
i have created 1 panel on right single finger pan gesture. have display view controller on same side when user swipes using 2 finger gesture. tried adding in swrevealviewcontroller.h class file isn't working . created 2 differnent seques , sw_right , sw_test .. if user swipes 1 finger sw_right seque's view controller displayed , if user swipes 2 finger seques sw_test segue's should displayed. please struck here. below code
static nsstring * const swseguerearidentifier = @"sw_rear"; static nsstring * const swseguefrontidentifier = @"sw_front"; static nsstring * const swseguerightidentifier = @"sw_right"; static nsstring * const swseguerightidentifier2 =@"sw_test"; // mytest - (void)prepareforsegue:(swrevealviewcontrollersegue *)segue sender:(id)sender { // $ using custom segue can access storyboard-loaded rear/front view controllers // trick define segues of type swrevealviewcontrollersegue on storyboard // connecting swrevealviewcontroller desired front/rear controllers, // , setting identifiers "sw_rear" , "sw_front" // $ these segues invoked manually in loadview method if storyboard // used instantiate swrevealviewcontroller // $ none of necessary if apple exposed "relationship" segues container view controllers. nsstring *identifier = segue.identifier; if ( [segue iskindofclass:[swrevealviewcontrollersegue class]] && sender == nil ) { if ( [identifier isequaltostring:swseguerearidentifier] ) { segue.performblock = ^(swrevealviewcontrollersegue* rvc_segue, uiviewcontroller* svc, uiviewcontroller* dvc) { [self _setrearviewcontroller:dvc animated:no]; }; } else if ( [identifier isequaltostring:swseguefrontidentifier] ) { segue.performblock = ^(swrevealviewcontrollersegue* rvc_segue, uiviewcontroller* svc, uiviewcontroller* dvc) { [self _setfrontviewcontroller:dvc animated:no]; }; } else if ( [identifier isequaltostring:swseguerightidentifier] ) { segue.performblock = ^(swrevealviewcontrollersegue* rvc_segue, uiviewcontroller* svc, uiviewcontroller* dvc) { [self _setrightviewcontroller:dvc animated:no]; }; } //mytest code **else if ( [identifier isequaltostring:swseguerightidentifier2] ) { segue.performblock = ^(swrevealviewcontrollersegue* rvc_segue, uiviewcontroller* svc, uiviewcontroller* dvc) { [self _setrightviewcontroller:dvc animated:no]; }; }** //code test } }
finally have got solution have 2 panels. used 1 controller displaying 2 different datas based on touches performed. here did. wrote code in reveal view controller
-(void)viewwillappear:(bool)animated { int numberoftouches = self.revealviewcontroller.pangesturerecognizer.numberoftouches; nslog(@"%d",numberoftouches); if (numberoftouches ==1) { numberoftouchesstring=@"one"; } else if (numberoftouches==2) { numberoftouchesstring=@"two"; } [learningsearchtableview reloaddata]; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if ([numberoftouchesstring isequaltostring:@"one"]) { return 6; } else if ([numberoftouchesstring isequaltostring:@"two"]) { return 5; } else return 0; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nslog(@"selected"); if ([numberoftouchesstring isequaltostring:@"one"]) { nslog(@"%@",indexpath); } else if ([numberoftouchesstring isequaltostring:@"two"]) { nslog(@"the other %@",indexpath); } } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"learningsearchcellidentifier"; learningsearchcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; if ([numberoftouchesstring isequaltostring:@"one"]) { cell.subjectnamelabel.text=@"art"; cell.subjecdataandsessionlabel.text=@"friday 11th april - ls3(cohort 11)"; cell.teachernamelabel.text=@"mr starr"; } else if ([numberoftouchesstring isequaltostring:@"two"]) { cell.subjectnamelabel.text=@"english"; cell.subjecdataandsessionlabel.text=@"sunday 12th april - ls3(cohort 11)"; cell.teachernamelabel.text=@"mr harry"; } return cell; }
Comments
Post a Comment