ios - Disable swipe gesture in UIPageViewController -
i have 3 viewcontrollers in 1 viewcontroller
viewpagercontroller = self -> viewcontroller , has uipageviewcontroller init
programquestionviewcontroller = based viewpagercontroller
questionviewcontroller = content view shown in middle of programviewcontroller
this viewpagercontroller
@interface viewpagercontroller () <uipageviewcontrollerdatasource, uipageviewcontrollerdelegate, uiscrollviewdelegate,uigesturerecognizerdelegate> { nsmutablearray *dataanswers; } @property uiscrollview *tabsview; @property uiview *contentview; @property uipageviewcontroller *pageviewcontroller; @property (assign) id<uiscrollviewdelegate> actualdelegate; @property (assign)bool isvalidpage; @property (assign)bool issonraki; // tab , content cache @property nsmutablearray *tabs; @property nsmutablearray *contents; // options @property (nonatomic) nsnumber *tabheight; @property (nonatomic) nsnumber *taboffset; @property (nonatomic) nsnumber *tabwidth; @property (nonatomic) nsnumber *tablocation; @property (nonatomic) nsnumber *startfromsecondtab; @property (nonatomic) nsnumber *centercurrenttab; @property (nonatomic) nsnumber *fixformertabspositions; @property (nonatomic) nsnumber *fixlattertabspositions; @property (nonatomic,retain)uibutton *backbutton; @property (nonatomic,retain)uibutton *nextbutton; @property (nonatomic) nsuinteger tabcount; @property (nonatomic) nsuinteger activetabindex; @property (nonatomic) nsuinteger activecontentindex; @property (getter = isanimatingtotab, assign) bool animatingtotab; @property (getter = isdefaultsetupdone, assign) bool defaultsetupdone; @property (nonatomic) uicolor *indicatorcolor; @property (nonatomic) uicolor *tabsviewbackgroundcolor; @property (nonatomic) uicolor *contentviewbackgroundcolor; @end @implementation viewpagercontroller @synthesize tabheight = _tabheight; @synthesize taboffset = _taboffset; @synthesize tabwidth = _tabwidth; @synthesize tablocation = _tablocation; @synthesize startfromsecondtab = _startfromsecondtab; @synthesize centercurrenttab = _centercurrenttab; @synthesize fixformertabspositions = _fixformertabspositions; @synthesize fixlattertabspositions = _fixlattertabspositions; @synthesize isvalidpage; @synthesize backbutton; @synthesize nextbutton; @synthesize issonraki; - (id)initwithcoder:(nscoder *)adecoder { self = [super initwithcoder:adecoder]; if (self) { [self defaultsettings]; } return self; } - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { [self defaultsettings]; } return self; } - (void)viewdidload { [super viewdidload]; issonraki=false; isvalidpage=true; dataanswers =[[nsmutablearray alloc] init]; uiimageview *pagerbackground = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"splash_bg.png"]]; pagerbackground.frame=cgrectmake(0, 800, self.view.frame.size.width, 160); [self.view setbackgroundcolor:[uicolor colorwithred:234.0/255.0 green:234.0/255.0 blue:234.0/255.0 alpha:0.75]]; backbutton = [uibutton buttonwithtype:uibuttontypecustom]; [backbutton setframe:cgrectmake(50, 875, 87, 45)]; [backbutton setbackgroundimage:[uiimage imagenamed:@"prev_btn.png"] forstate:uicontrolstatenormal]; //uitapgesturerecognizer *tapgesturerecognizerback = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handlebacktapgesture:)]; //[backbutton addgesturerecognizer:tapgesturerecognizerback]; [backbutton addtarget:self action:@selector(handlebacktapgesture:) forcontrolevents:uicontroleventtouchupinside]; backbutton.hidden=yes; nextbutton = [uibutton buttonwithtype:uibuttontypecustom]; [nextbutton setframe:cgrectmake(620, 875, 87, 45)]; [nextbutton setbackgroundimage:[uiimage imagenamed:@"next_btn.png"] forstate:uicontrolstatenormal]; //uitapgesturerecognizer *tapgesturerecognizernext = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handlenexttapgesture:)]; //[nextbutton addgesturerecognizer:tapgesturerecognizernext]; [nextbutton addtarget:self action:@selector(handlenexttapgesture:) forcontrolevents:uicontroleventtouchupinside]; (uigesturerecognizer *gr in [self.pageviewcontroller gesturerecognizers]) { [gr setenabled:no]; } [self.view addsubview:nextbutton]; [self.view addsubview:backbutton]; } -(bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldreceivetouch:(uitouch *)touch { //touch gestures below top bar should not make page turn. //edited check tap here instead. if ([gesturerecognizer iskindofclass:[uitapgesturerecognizer class]]) { cgpoint touchpoint = [touch locationinview:self.view]; if (touchpoint.y > 40) { return no; } else if (touchpoint.x > 50 && touchpoint.x < 430) {//let buttons in middle of top bar receive touch return no; } } return yes; } - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; // setup if it's not done yet if (![self isdefaultsetupdone]) { [self defaultsetup]; nslog(@"hello"); } } - (void)viewwilllayoutsubviews { // re-layout sub views [self layoutsubviews]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; } - (void)layoutsubviews { cgfloat toplayoutguide = 0.0; cgrect frame = self.tabsview.frame; frame.origin.x = 150.0; frame.origin.y = [self.tablocation boolvalue] ? toplayoutguide : cgrectgetheight(self.view.frame) - [self.tabheight floatvalue]; frame.size.width = 450;//cgrectgetwidth(self.view.frame); frame.size.height = [self.tabheight floatvalue]; self.tabsview.frame = frame; frame = self.contentview.frame; frame.origin.x = 0.0; frame.origin.y = [self.tablocation boolvalue] ? toplayoutguide + cgrectgetheight(self.tabsview.frame) : toplayoutguide; frame.size.width = cgrectgetwidth(self.view.frame); frame.size.height = cgrectgetheight(self.view.frame) - (toplayoutguide + cgrectgetheight(self.tabsview.frame)) - cgrectgetheight(self.tabbarcontroller.tabbar.frame); self.contentview.frame = frame; } - (ibaction)handletapgesture:(id)sender { } - (ibaction)handlenexttapgesture:(id)sender { //uiview *myvview=[self.datasource viewpager:self contentviewfortabatindex:0]; //backbutton.hidden=no; uiviewcontroller *viewcontroller = [self.datasource viewpager:self contentviewcontrollerfortabatindex:_activecontentindex]; uiviewcontroller *xvc=[loggedinuser sharedcenter].myquestionview; [self savemydata:xvc]; if (isvalidpage) { [self selecttabatindex:self.activecontentindex+1]; } } - (ibaction)handlebacktapgesture:(id)sender { if(self.activetabindex==0) { backbutton.hidden=yes; } else { backbutton.hidden=no; } uiviewcontroller *viewcontroller = [self.datasource viewpager:self contentviewcontrollerfortabatindex:_activecontentindex]; uiviewcontroller *xvc=[loggedinuser sharedcenter].myquestionview; [self savemydata:xvc]; if (isvalidpage) { [self selecttabatindex:self.activecontentindex-1]; } } - (void)setactivetabindex:(nsuinteger)activetabindex { tabview *activetabview; // set to-be-inactive tab unselected activetabview = [self tabviewatindex:self.activetabindex]; activetabview.selected = no; // set to-be-active tab selected activetabview = [self tabviewatindex:activetabindex]; activetabview.selected = yes; // set current activetabindex _activetabindex = activetabindex; // bring tab active position // position tab in center if centercurrenttab option provided yes uiview *tabview = [self tabviewatindex:self.activetabindex]; cgrect frame = tabview.frame; if ([self.centercurrenttab boolvalue]) { frame.origin.x += (cgrectgetwidth(frame) / 2); frame.origin.x -= cgrectgetwidth(self.tabsview.frame) / 2; frame.size.width = cgrectgetwidth(self.tabsview.frame); if (frame.origin.x < 0) { frame.origin.x = 0; } if ((frame.origin.x + cgrectgetwidth(frame)) > self.tabsview.contentsize.width) { frame.origin.x = (self.tabsview.contentsize.width - cgrectgetwidth(self.tabsview.frame)); } } else { //frame.origin.x -= [self.taboffset floatvalue]; frame.origin.x -= [self.taboffset floatvalue]; frame.size.width = cgrectgetwidth(self.tabsview.frame); } [self.tabsview scrollrecttovisible:frame animated:yes]; } - (void)setactivecontentindex:(nsuinteger)activecontentindex { // desired viewcontroller uiviewcontroller *viewcontroller = [self viewcontrolleratindex:activecontentindex]; if (!viewcontroller) { viewcontroller = [[uiviewcontroller alloc] init]; viewcontroller.view = [[uiview alloc] init]; viewcontroller.view.backgroundcolor = [uicolor clearcolor]; } // __weak pageviewcontroller used in blocks prevent retaining strong reference self __weak uipageviewcontroller *weakpageviewcontroller = self.pageviewcontroller; __weak viewpagercontroller *weakself = self; if (activecontentindex == self.activecontentindex) { [self.pageviewcontroller setviewcontrollers:@[viewcontroller] direction:uipageviewcontrollernavigationdirectionforward animated:no completion:^(bool completed) { weakself.animatingtotab = no; }]; } else if (!(activecontentindex + 1 == self.activecontentindex || activecontentindex - 1 == self.activecontentindex)) { [self.pageviewcontroller setviewcontrollers:@[viewcontroller] direction:(activecontentindex < self.activecontentindex) ? uipageviewcontrollernavigationdirectionreverse : uipageviewcontrollernavigationdirectionforward animated:yes completion:^(bool completed) { weakself.animatingtotab = no; // set current page again obtain synchronisation between tabs , content dispatch_async(dispatch_get_main_queue(), ^{ [weakpageviewcontroller setviewcontrollers:@[viewcontroller] direction:(activecontentindex < weakself.activecontentindex) ? uipageviewcontrollernavigationdirectionreverse : uipageviewcontrollernavigationdirectionforward animated:no completion:nil]; }); }]; } else { [self.pageviewcontroller setviewcontrollers:@[viewcontroller] direction:(activecontentindex < self.activecontentindex) ? uipageviewcontrollernavigationdirectionreverse : uipageviewcontrollernavigationdirectionforward animated:yes completion:^(bool completed) { weakself.animatingtotab = no; }]; } // clean out of sight contents nsinteger index; index = self.activecontentindex - 1; if (index >= 0 && index != activecontentindex && index != activecontentindex - 1) { [self.contents replaceobjectatindex:index withobject:[nsnull null]]; } index = self.activecontentindex; if (index != activecontentindex - 1 && index != activecontentindex && index != activecontentindex + 1) { [self.contents replaceobjectatindex:index withobject:[nsnull null]]; } index = self.activecontentindex + 1; if (index < self.contents.count && index != activecontentindex && index != activecontentindex + 1) { [self.contents replaceobjectatindex:index withobject:[nsnull null]]; } _activecontentindex = activecontentindex; } - (void)reloaddata { // empty options , colors // that, viewpager reflect changes // empty options _tabheight = nil; _taboffset = nil; _tabwidth = nil; _tablocation = nil; _startfromsecondtab = nil; _centercurrenttab = nil; _fixformertabspositions = nil; _fixlattertabspositions = nil; // empty colors _indicatorcolor = nil; _tabsviewbackgroundcolor = nil; _contentviewbackgroundcolor = nil; // call setup again updated data [self defaultsetup]; } - (void)selecttabatindex:(nsuinteger)index { if (index >= self.tabcount) { return; } self.animatingtotab = yes; // set activetabindex self.activetabindex = index; // set activecontentindex self.activecontentindex = index; // inform delegate change if ([self.delegate respondstoselector:@selector(viewpager:didchangetabtoindex:)]) { [self.delegate viewpager:self didchangetabtoindex:self.activetabindex]; } } - (void)setneedsreloadoptions { // if our delegate doesn't respond our options method, return // otherwise reload options if (![self.delegate respondstoselector:@selector(viewpager:valueforoption:withdefault:)]) { return; } // update these options self.tabwidth = [nsnumber numberwithfloat:[self.delegate viewpager:self valueforoption:viewpageroptiontabwidth withdefault:ktabwidth]]; self.taboffset = [nsnumber numberwithfloat:[self.delegate viewpager:self valueforoption:viewpageroptiontaboffset withdefault:ktaboffset]]; self.centercurrenttab = [nsnumber numberwithfloat:[self.delegate viewpager:self valueforoption:viewpageroptioncentercurrenttab withdefault:kcentercurrenttab]]; self.fixformertabspositions = [nsnumber numberwithfloat:[self.delegate viewpager:self valueforoption:viewpageroptionfixformertabspositions withdefault:kfixformertabspositions]]; self.fixlattertabspositions = [nsnumber numberwithfloat:[self.delegate viewpager:self valueforoption:viewpageroptionfixlattertabspositions withdefault:kfixlattertabspositions]]; // should update contentsize property of our tabsview, should recalculate new values cgfloat contentsizewidth = 0; // give standard offset if fixformertabspositions provided yes if ([self.fixformertabspositions boolvalue]) { // , if centercurrenttab provided yes fine tune offset according if ([self.centercurrenttab boolvalue]) { contentsizewidth = (cgrectgetwidth(self.tabsview.frame) - [self.tabwidth floatvalue]) / 2.0; } else { contentsizewidth = [self.taboffset floatvalue]; } } // update every tab's frame (nsuinteger = 0; < self.tabcount; i++) { uiview *tabview = [self tabviewatindex:i]; cgrect frame = tabview.frame; frame.origin.x = contentsizewidth; frame.size.width = [self.tabwidth floatvalue]; tabview.frame = frame; contentsizewidth += cgrectgetwidth(tabview.frame); } // extend contentsizewidth if fixlattertabspositions provided yes if ([self.fixlattertabspositions boolvalue]) { // , if centercurrenttab provided yes fine tune content size according if ([self.centercurrenttab boolvalue]) { contentsizewidth += (cgrectgetwidth(self.tabsview.frame) - [self.tabwidth floatvalue]) / 2.0; } else { contentsizewidth += cgrectgetwidth(self.tabsview.frame) - [self.tabwidth floatvalue] - [self.taboffset floatvalue]; } } // update tabsview's contentsize new width self.tabsview.contentsize = cgsizemake(contentsizewidth, [self.tabheight floatvalue]); } - (void)setneedsreloadcolors { // if our delegate doesn't respond our colors method, return // otherwise reload colors if (![self.delegate respondstoselector:@selector(viewpager:colorforcomponent:withdefault:)]) { return; } // these colors updated uicolor *indicatorcolor; uicolor *tabsviewbackgroundcolor; uicolor *contentviewbackgroundcolor; // indicatorcolor , check if different current 1 // if is, update indicatorcolor = [self.delegate viewpager:self colorforcomponent:viewpagerindicator withdefault:kindicatorcolor]; if (![self.indicatorcolor isequaltocolor:indicatorcolor]) { // iterate through of tabs update indicatorcolor [self.tabs enumerateobjectsusingblock:^(tabview *tabview, nsuinteger index, bool *stop) { tabview.indicatorcolor = indicatorcolor; }]; // update indicatorcolor check again later self.indicatorcolor = indicatorcolor; } // tabsviewbackgroundcolor , check if different current 1 // if is, update tabsviewbackgroundcolor = [self.delegate viewpager:self colorforcomponent:viewpagertabsview withdefault:ktabsviewbackgroundcolor]; if (![self.tabsviewbackgroundcolor isequaltocolor:tabsviewbackgroundcolor]) { // update self.tabsview.backgroundcolor = tabsviewbackgroundcolor; // update tabsviewbackgroundcolor check again later self.tabsviewbackgroundcolor = tabsviewbackgroundcolor; } // contentviewbackgroundcolor , check if different current 1 // yeah update it, //contentviewbackgroundcolor = [self.delegate viewpager:self colorforcomponent:viewpagercontent withdefault:kcontentviewbackgroundcolor]; //if (![self.contentviewbackgroundcolor isequaltocolor:contentviewbackgroundcolor]) { // yup, update // self.contentview.backgroundcolor = contentviewbackgroundcolor; // update this, too, check again later // self.contentviewbackgroundcolor = contentviewbackgroundcolor; //} } - (cgfloat)valueforoption:(viewpageroption)option { switch (option) { case viewpageroptiontabheight: return [[self tabheight] floatvalue]; case viewpageroptiontaboffset: return [[self taboffset] floatvalue]; case viewpageroptiontabwidth: return [[self tabwidth] floatvalue]; case viewpageroptiontablocation: return [[self tablocation] floatvalue]; case viewpageroptionstartfromsecondtab: return [[self startfromsecondtab] floatvalue]; case viewpageroptioncentercurrenttab: return [[self centercurrenttab] floatvalue]; default: return nan; } } -(void)setscrollenabled:(bool)enabled forpageviewcontroller:(uipageviewcontroller*)pageviewcontroller{ for(uiview* view in pageviewcontroller.view.subviews){ if([view iskindofclass:[uiscrollview class]]){ uiscrollview* scrollview=(uiscrollview*)view; [scrollview setscrollenabled:enabled]; return; } } } - (void)defaultsettings { // pageviewcontroller self.pageviewcontroller = [[uipageviewcontroller alloc] initwithtransitionstyle:uipageviewcontrollertransitionstylescroll navigationorientation:uipageviewcontrollernavigationorientationhorizontal options:nil]; [self addchildviewcontroller:self.pageviewcontroller]; // setup forwarding events hijack scrollview // keep reference actual delegate self.actualdelegate = ((uiscrollview *)[self.pageviewcontroller.view.subviews objectatindex:0]).delegate; // set self new delegate ((uiscrollview *)[self.pageviewcontroller.view.subviews objectatindex:0]).delegate = self; self.pageviewcontroller.datasource = self; self.pageviewcontroller.delegate = self; self.animatingtotab = no; self.defaultsetupdone = no; } - (void)defaultsetup { // empty tabs , contents (uiview *tabview in self.tabs) { [tabview removefromsuperview]; } self.tabsview.contentsize = cgsizezero; [self.tabs removeallobjects]; [self.contents removeallobjects]; // tabcount datasource self.tabcount = [self.datasource numberoftabsforviewpager:self]; // populate arrays [nsnull null]; self.tabs = [nsmutablearray arraywithcapacity:self.tabcount]; (nsuinteger = 0; < self.tabcount; i++) { [self.tabs addobject:[nsnull null]]; } self.contents = [nsmutablearray arraywithcapacity:self.tabcount]; (nsuinteger = 0; < self.tabcount; i++) { [self.contents addobject:[nsnull null]]; } // add tabsview self.tabsview = (uiscrollview *)[self.view viewwithtag:ktabviewtag]; if (!self.tabsview) { self.tabsview = [[uiscrollview alloc] initwithframe:cgrectmake(0.0, 0.0, cgrectgetwidth(self.view.frame), [self.tabheight floatvalue])]; self.tabsview.autoresizingmask = uiviewautoresizingflexiblewidth; self.tabsview.backgroundcolor = self.tabsviewbackgroundcolor; self.tabsview.scrollstotop = no; self.tabsview.showshorizontalscrollindicator = no; self.tabsview.showsverticalscrollindicator = no; self.tabsview.tag = ktabviewtag; [self.view insertsubview:self.tabsview atindex:0]; } // add tab views _tabsview cgfloat contentsizewidth = 0; // give standard offset if fixformertabspositions provided yes if ([self.fixformertabspositions boolvalue]) { // , if centercurrenttab provided yes fine tune offset according if ([self.centercurrenttab boolvalue]) { contentsizewidth = (cgrectgetwidth(self.tabsview.frame) - [self.tabwidth floatvalue]) / 2.0; } else { contentsizewidth = [self.taboffset floatvalue]; } } (nsuinteger = 0; < self.tabcount; i++) { uiview *tabview = [self tabviewatindex:i]; cgrect frame = tabview.frame; frame.origin.x = contentsizewidth; frame.size.width = [self.tabwidth floatvalue]; tabview.frame = frame; [self.tabsview addsubview:tabview]; contentsizewidth += cgrectgetwidth(tabview.frame); uitapgesturerecognizer *tapgesturerecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletapgesture:)]; [tabview addgesturerecognizer:tapgesturerecognizer]; } contentsizewidth=contentsizewidth-500; if ([self.fixlattertabspositions boolvalue]) { if ([self.centercurrenttab boolvalue]) { contentsizewidth += (cgrectgetwidth(self.tabsview.frame) - [self.tabwidth floatvalue]) / 2.0; } else { contentsizewidth += cgrectgetwidth(self.tabsview.frame) - [self.tabwidth floatvalue] - [self.taboffset floatvalue]; } } self.tabsview.contentsize = cgsizemake(contentsizewidth, [self.tabheight floatvalue]); self.contentview = [self.view viewwithtag:kcontentviewtag]; if (!self.contentview) { self.contentview = self.pageviewcontroller.view; self.contentview.autoresizingmask = uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth; // self.contentview.backgroundcolor = self.contentviewbackgroundcolor; self.contentview.bounds = self.view.bounds; self.contentview.tag = kcontentviewtag; [self.view insertsubview:self.contentview atindex:0]; } nsuinteger index = [self.startfromsecondtab boolvalue] ? 1 : 0; [self selecttabatindex:index]; self.defaultsetupdone = yes; } - (tabview *)tabviewatindex:(nsuinteger)index { if (index >= self.tabcount) { return nil; } if ([[self.tabs objectatindex:index] isequal:[nsnull null]]) { uiview *tabviewcontent = [self.datasource viewpager:self viewfortabatindex:index]; tabviewcontent.autoresizingmask = uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth; tabview *tabview = [[tabview alloc] initwithframe:cgrectmake(0.0, 0.0, [self.tabwidth floatvalue], [self.tabheight floatvalue])]; [tabview addsubview:tabviewcontent]; [tabview setclipstobounds:yes]; [tabview setindicatorcolor:self.indicatorcolor]; tabviewcontent.center = tabview.center; // replace null object tabview [self.tabs replaceobjectatindex:index withobject:tabview]; } return [self.tabs objectatindex:index]; } - (uiviewcontroller *)viewcontrolleratindex:(nsuinteger)index { if (index >= self.tabcount) { return nil; } if ([[self.contents objectatindex:index] isequal:[nsnull null]]) { uiviewcontroller *viewcontroller; if ([self.datasource respondstoselector:@selector(viewpager:contentviewcontrollerfortabatindex:)]) { viewcontroller = [self.datasource viewpager:self contentviewcontrollerfortabatindex:index]; } else if ([self.datasource respondstoselector:@selector(viewpager:contentviewfortabatindex:)]) { uiview *view = [self.datasource viewpager:self contentviewfortabatindex:index]; // adjust view's bounds match pageview's bounds uiview *pageview = [self.view viewwithtag:kcontentviewtag]; view.frame = pageview.bounds; viewcontroller = [uiviewcontroller new]; viewcontroller.view = view; } else { viewcontroller = [[uiviewcontroller alloc] init]; viewcontroller.view = [[uiview alloc] init]; } [self.contents replaceobjectatindex:index withobject:viewcontroller]; } return [self.contents objectatindex:index]; } - (nsuinteger)indexforviewcontroller:(uiviewcontroller *)viewcontroller { return [self.contents indexofobject:viewcontroller]; } - (uiviewcontroller *)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller viewcontrollerafterviewcontroller:(uiviewcontroller *)viewcontroller { nsuinteger index = [self indexforviewcontroller:viewcontroller]; index++; return [self viewcontrolleratindex:index]; } - (uiviewcontroller *)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller viewcontrollerbeforeviewcontroller:(uiviewcontroller *)viewcontroller { nsuinteger index = [self indexforviewcontroller:viewcontroller]; index--; return [self viewcontrolleratindex:index]; } - (void)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller didfinishanimating:(bool)finished previousviewcontrollers:(nsarray *)previousviewcontrollers transitioncompleted:(bool)completed { uiviewcontroller *viewcontroller = self.pageviewcontroller.viewcontrollers[0]; // select tab nsuinteger index = [self indexforviewcontroller:viewcontroller]; [self selecttabatindex:index]; }
i don't want let swipe on pageviewcontroller want handle paging next , buttons only, can't disable swipe gesture. possible disable or other ways remove gestures in view?
try
for (uiscrollview *view in self.pageviewcontroller.view.subviews) { if ([view iskindofclass:[uiscrollview class]]) { view.scrollenabled = no; } }
Comments
Post a Comment