Closed raitmoon closed 9 years ago
This method will help you
(CGFloat)viewPager:(ViewPagerController *)viewPager valueForOption:(ViewPagerOption)option withDefault:(CGFloat)value {
switch (option) { case ViewPagerOptionStartFromSecondTab: return 0.0; case ViewPagerOptionCenterCurrentTab: return 1.0; case ViewPagerOptionTabLocation: return 0.0; case ViewPagerOptionTabHeight: return 49.0; case ViewPagerOptionTabOffset: return 36.0; case ViewPagerOptionTabWidth: return UIInterfaceOrientationIsLandscape(self.interfaceOrientation) ? 128.0 : 96.0; case ViewPagerOptionFixFormerTabsPositions: return 1.0; case ViewPagerOptionFixLatterTabsPositions: return 1.0; default: return value; } }
Dhgillani, thanks for your comment. But I can not figure out, can you explain a bit more?
Sorry my question may not be good. It seems the parent view controller of the child view controller is not viewpagercontroller. And my program does not go into "if clause".
Hey there, sorry for late reply. It won't work because view pager passes the content view controllers to UIPageViewController
and as far as I know it doesn't add itself as parent view controller to the presented view controllers. One way to achieve your goal is adding a weak property to the content view controllers and assigning ViewPagerController
subclass to it. This way you will be able to send messages to your ViewPagerController
subclass to change its tab.
Hello, iltercengiz
Thanks for your reply! I could have done it as you adviced me.
Thank you
Hello,
I have a question. I want to know how to call viewpager's selectTabAtIndex method from childviewcontroller. I tried as below but it could not work.
Can you please give me any clue?