class SwipeTitleController
Constants
- CELL_ID
Attributes
delegate[RW]
selectedIndex[RW]
Public Instance Methods
scrollToItemAtIndex(index)
click to toggle source
# File lib/swipe_title/swipe_title_controller.rb, line 33 def scrollToItemAtIndex index @swipeController.scrollToItemAtIndex index @pageControl.currentPage = index end
swipeBegan()
click to toggle source
Called by Swipe Collection View Controller
# File lib/swipe_title/swipe_title_controller.rb, line 54 def swipeBegan view.layer.shadowOpacity = 1 end
swipeEnded()
click to toggle source
# File lib/swipe_title/swipe_title_controller.rb, line 58 def swipeEnded UIView.transitionWithView view, duration: 0.1, options: UIViewAnimationOptionTransitionCrossDissolve, animations: -> { view.layer.shadowOpacity = 0 }, completion:nil end
swipeTitleControllerSelectedIndex(controller, index)
click to toggle source
# File lib/swipe_title/swipe_title_controller.rb, line 38 def swipeTitleControllerSelectedIndex controller, index @pageControl.currentPage = index delegate.swipeTitleControllerSelectedIndex controller, index end
titles=(titles)
click to toggle source
# File lib/swipe_title/swipe_title_controller.rb, line 43 def titles= titles @pageControl.numberOfPages = titles.length @pageControl.hidden = titles.length == 1 @swipeController.titles = titles @swipeController.reloadData end
viewDidLoad()
click to toggle source
# File lib/swipe_title/swipe_title_controller.rb, line 8 def viewDidLoad view.layer.tap do |l| l.masksToBounds = false l.cornerRadius = 5 l.shadowOffset = CGSizeMake(0, 0) l.shadowRadius = 8 l.shadowOpacity = 0 end @swipeController = SwipeCollectionViewController.alloc.initWithFrame(CGRectZero) @swipeController.delegate = self view.addSubview @swipeController.collectionView @pageControl = UIPageControl.alloc.initWithFrame(CGRectZero) @pageControl.userInteractionEnabled = false view.addSubview @pageControl end
viewWillLayoutSubviews()
click to toggle source
# File lib/swipe_title/swipe_title_controller.rb, line 26 def viewWillLayoutSubviews @swipeController.collectionView.frame = CGRectMake(0, 0, view.frame.size.width, view.frame.size.height) @pageControl.frame = CGRectMake(0, view.frame.size.height - 14, view.frame.size.width, 14) end