Skip to content

Commit

Permalink
修改防止越界
Browse files Browse the repository at this point in the history
  • Loading branch information
郑国凯 authored and 郑国凯 committed Jan 19, 2016
1 parent 626c33e commit d09b4a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Binary file not shown.
8 changes: 8 additions & 0 deletions TestPageViewController/FECustomPageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,18 @@ class FECustomPageViewController: UIViewController, UIPageViewControllerDelegate
zoomRect.origin.x = scrollView.frame.width - zoomRect.size.width
}

if zoomRect.origin.x < 0 {
zoomRect.origin.x = 0
}

if zoomRect.origin.y + zoomRect.size.height > scrollView.frame.height {
zoomRect.origin.y = scrollView.frame.height - zoomRect.size.height
}

if zoomRect.origin.y < 0 {
zoomRect.origin.y = 0
}

return zoomRect

}
Expand Down
3 changes: 1 addition & 2 deletions TestPageViewController/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ class ViewController: UIViewController {

let pageController = FECustomPageViewController()

// pageController.imageType = .ImageTypeCarousel
pageController.list_image = [UIImage(named: "guide_page_one")!, UIImage(named: "guide_page_two")!, UIImage(named: "guide_page_three")!, UIImage(named: "1.pic.jpg")!]

pageController.imageType = .ImageTypeCarousel
// pageController.imageType = .ImageTypeCarousel

pageController.tapHandler = {
print("hello")
Expand Down

0 comments on commit d09b4a0

Please sign in to comment.