#UIPageViewController
Explore tagged Tumblr posts
Photo
ios - Achieving Edge-to-Edge Full Screen Effect with UICollectionView in UIPageViewController
0 notes
Link
original source : https://stackoverflow.com/questions/36663500/counting-up-down-numbers-animation
#1 answer
https://stackoverflow.com/a/36663658/3151712
You can use NSTimer to achieve this.
Here is example project I created for you.
Create layout like this:
Then in your ViewController do like so:
import UIKit class ViewController: UIViewController { @IBOutlet var countingLabel: UILabel! var number = 0 var destinationNumber = 30 var timer: NSTimer! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func startButtonTapped(sender: AnyObject) { timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: "countUp", userInfo: nil, repeats: true) } func countUp() { if number < destinationNumber { number += 1 countingLabel.text = "\(number)" } else { timer.invalidate() } } }
It will work.
2 notes
·
View notes
Text
Get the Current Index in UIPageViewController Regardless of Swipe Direction
Just implement this UIPageViewControllerDelegate optional method and it will get you your current index provided that your view controller has a property to store the index
func pageViewController(pageViewController: UIPageViewController, willTransitionToViewControllers pendingViewControllers: [UIViewController])
I also posted my answer here:
http://stackoverflow.com/questions/17766832/uipageviewcontroller-get-the-currentpage/34605032#34605032
1 note
·
View note
Text
UIPageViewController in UINavigationController only updates autolayout constraints for top layout guide in viewDidAppear (or similar)
When A UIPageViewController is used inside a UINavigationController constraints in the managed view controllers related to the top layout guide are setup/updated to late. They should be update in viewWillAppear, before any part of the shown pages is first displayed. Instead the constraints are only updated on what appear to be viewDidAppear: or a similar method. At least, the constraints are only correct after the page view controller’s animation finished, not during the animation of a newly loaded child view controller.
http://openradar.appspot.com/21728584
0 notes
Text
pageViewController naming!
If FooPageViewController is a subclass UIPageViewController, then what do I name the UIViewController class that's responsible for each of the individual pages in that page view controller?
0 notes
Text
6월 iOS Study 후기
iOS Study에 다녀왔다. 4월에 참석하고, 5월에 빠지고. 2번째 참석!
이번 스터디는 대부분 UI에 대한 부분이었는데 iOS 6에서 추가된 Auto Layout과 iOS 5에서 생긴 UIPageViewController, 그리고 UIPickerView, UIDatePickerView를 다뤘다.
Auto Layout의 목적은 디바이스 화면 사이즈와 방향에 독립적인 레이아웃에서 뷰들이 해야 하는 동작들을 개발자들이 기술할 수 있도록 하는 것이다. 이러한 동작은 컨스트레인트(Constraint)로 구현된다.
Auto Layout은 기존의 오토사이징(autosizing)과는 달리, 하위 뷰와 상위 뷰에 대한 부분 뿐만 아니라 하위 뷰들 간의 컨스트레인트들을 선언할 수도 있다. 컨스트레인트는 0부터 1000까지 범위의 우선순위를 가지며 우선순위에 따라 적용된다. 필수적인 컨스트레인트(required constraint)는 1000으로 표시된다.
컨스트레인트는 인터페이스 빌더 또는 시각적 형식 언어, API 코드(NSLayoutConstraint)로 작성된다.
주의할 점은 Auto Layout이 적용된 뷰에 애니메이션이 적용될 때에도 Auto Layout이 같이 적용되기 때문에 부자연스러운 처리가 발생할 수 있고, 이런 부분은 코드로 해결해야 한다.
UIPageViewController는 페이지가 넘어가는 듯한 사용자 인터페이스 구현을 지원한다. UIPageViewController는 여러 개의 뷰 컨트롤러들을 포함하고 관리하는 컨테이너 컨트롤러의 일종이고 하나의 뷰 컨트롤러에서 다른 뷰 컨트롤러로 전환하는 방법을 제공한다.
UIPageViewControllerDataSource 프로토콜은 반드시 다음 두 메서드를 구현해야 한다. * viewControllerAfterViewController: - 이 메서드는 현재 표시되고 있는 페이지의 뷰 컨트롤러를 전달받고 다음 페이지를 표시할 뷰 컨트롤러를 리턴한다. * viewControllerBeforeViewController: - 이 메서드는 현재 표시되고 있는 페이지의 뷰 컨트롤러를 전달받고 전 페이지를 표시할 뷰 컨트롤러를 리턴한다.
UIPageViewController는 수직 혹인 수평으로 뷰들을 전환할 수 있다. - UIPageViewControllerNavigationOrientationalHorizontal - UIPageViewControllerNavigationOrientationalVertical
UIPageViewController는 스파인(spine)의 위치를 설정할 있다. 스파인인 각 페이지가 넘겨지는 축의 위치를 의미한다.
UIPageViewControllerDelegate 프로토콜 * spineLocationForInterface: - 이 델리게이트 메서드의 역할은 사용자에 의해 기기가 회전을 하였을 때 스파인 위치가 바뀔 수 있게 한다. * transitionComplete: - 이 메서드는 화면 기반의 제스처에 의해 페이지 전환이 끝난 후 호출된다.
그 외에는 간단한 예제 위주로 진행되었고, 많은 iOS 개발자들이 참석해주셨다. 다음 달부터는 빠지지 말고 나가야지!
0 notes