ios - UIScrollView Stop working after push view to UINavigationController -
the scrollview in main page stop working if push navigation controller , pop main page. works if reopen application without pushing navigation controller yet. scrollview horizontal scrollview extends beyond frame. use scroll through buttons when switch application in ios (ios multitasking).
this code push new vc
uiviewcontroller *newvc = [[uiviewcontroller alloc] init]; uilabel *label = [[uilabel alloc] initwithframe:self.view.bounds]; [label settextalignment:nstextalignmentcenter]; label.text = [nsstring stringwithformat:@"promo %i detail view",[sender tag]]; label.backgroundcolor = [uicolor whitecolor]; [newvc.view addsubview:label]; [self.navigationcontroller setnavigationbarhidden:no animated:no]; [self.navigationcontroller pushviewcontroller:newvc animated:yes]; when view controller popped , navigation controller move main page hide navigationbar.
- (void)navigationcontroller:(uinavigationcontroller *)navigationcontroller willshowviewcontroller:(uiviewcontroller *)viewcontroller animated:(bool)animated { if(viewcontroller == self){ [self.navigationcontroller setnavigationbarhidden:yes]; nslog(@"%d", [self.scrollmenubar isscrollenabled]); } } checking isscrollenable return true.
i tried pushing normal modal view , same problem occur.
if resize scroll view content size in viewdidlayoutsubview function work again.
- (void) viewdidlayoutsubviews { [self resizescrollviewcontent]; }
Comments
Post a Comment