cemolcay / SlidingContainerViewController

An android scrollable tab bar style container view controller
MIT License
217 stars 41 forks source link

i wanted to know the current visible view controller #23

Open arshadsk5 opened 6 years ago

arshadsk5 commented 6 years ago

I have two view controllers VC1 and VC2, Both are loaded at the same time in background. Api's of both the screens are also loaded at the same time in background. I wanted to load only one view controller at a time and i have to load another view controller only when i moved to that particular view controller. I have a scenario, if there is no internet connection i need display a alert popup, on dismiss i need to call that particular view controller's api. But as of now both the view controllers are being loaded, i am getting two alert popups at a time.

Please help me, thanks in advance.

Wolfaks commented 5 years ago

Hello friend. Function "slidingContainerViewControllerDidMoveToViewController" have variable with current position of slider. It's name "atIndex";

I save it so: func slidingContainerViewControllerDidMoveToViewController(_ slidingContainerViewController: SlidingContainerViewController, viewController: UIViewController, atIndex: Int) { self.SliderNow = atIndex }