UIPageControl tap to "swipe"? - iphone

What method to I use to make my UIScrollView update when the sides of a UIPageControl are tapped? When swiping the UIScrollView, the UIPageControl is updated correctly, but if I tap the sides of the UIPageControl to go to the next page, only the dots update, but the UIScrollView won't swipe. I've looked in the docs and am unable to find any methods for this?
If you're unsure of what I mean, go to your iPhone home screen and tap either side of the white dots, right between the dock and the paged icons.

Just make sure you're giving your page control enough width, and you've hooked up its Value Changed outlet. If you do this, you should get messages when its value changes; look at the currentPage property on the control. It handles left- and right-margin taps properly.

The method you're looking for is:
UIScrollView scrollRectToVisible: animated:
If you do this on the UIPageControl valueChanged, it should be automatic.

See my answer here: Is UIPageControl Useless By Itself?
for a reusable class encapsulating the UIPageControl and UIScrollView.

Related

UIScrollView embedded inside of a View that is paged using UIPageViewController

I have an app with the following layout:
UIPageViewController (set to scroll style)
--- UIViewControllers
--------UIView
-----------UIScrollView
---------------UIImageViews
Right now, the UIPageViewControllers work correctly and I can swipe left and right through the various viewcontrollers. However, on each view of the viewcontroller is a UIScrollView of UIImageViews. I cannot get this innerscrollview to respond to any swipes. I'm assuming the UIPageViewController is swallowing all the gestures.
I searched on SO and found some other solutions, namely to try to grab the delegates for the UIpageViewController's gesture recognizers, but since my UIPageViewController is set to Scroll style, self.pageViewController.gestureRecognizers returns 0.
Here is an image to show what I'm talking about:
Is there any way to fix this? Thank you!

Cannot Impliment UITextview inside a UIPageViewController

I have a strange issue , I have a page app in which one page I had used a UITextView, but when I tap on the UITextView it moves to the next page, can't write anything on it.
There is no issue when I use UIPageViewControllerTransitionStylePageCurl. The only issue is with UIPageViewControllerTransitionStyleScroll. Anyone know the solution? please help me
I ran into the same issue myself, and it appears that it's a consequence of some default behavior that occurs whenever a UITextField or UITextView becomes first responder inside a UIScrollView.
The solution to prevent your UITextView from scrolling the UIPageViewController is to first embed it into a UIScrollView instead of directly into a page's main view.
This works because when the UITextView becomes first responder it will search for the earliest superview in the view hierarchy that is of type UIScrollView, and it will scroll that scrollview to accommodate for the keyboard covering the screen. If you don't wrap the UITextView inside a UIScrollView, your UIPageViewController's internal UIScrollView will be chosen and scrolled, producing undesired behavior.
You can refer the link below..
UIPageViewControllerTransitionStylePageCurl - http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html
UIPageViewControllerTransitionStyleScroll - http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html

How to hide a part of my UIView?

I have few other UI in my UIView and i have a UIButton on the top which i want to be hidden until unless the user scrolls to see the content on the very top and then display the UIButton.
Is there a way to implement this.
Thanks,
UIView (and thus everything sub-classing it) has a hidden property, this includes a UIButton. You can simply set this to YES/NO to hide/show something to the user.
After that the real question comes down to the show/hide criteria and how to measure it. If you are using a UIScrollView then you can add/implement UIScrollViewDelegate. This will give you methods like scrollViewDidScrollToTop: to check if the user scrolled to the top.
Keep track of the previous scroll offset so that with each scroll you can compute the delta, telling you whether the user scrolled up or down. With that, you can toggle the button's "hidden" property. Hope that helps.

How To Replicate This UIPageControl Look?

I want to replicate the functionality of this view in this app.
It has a UIPageControl at the bottom with 3 views that only changes the view at the bottom, and not the whole view.
Any basic advice on how to accomplish this?
Well, UIPageControl simply sends events informing you to change a page...
I would place the bottom view in a UIScrollView (that in turn would contain the 3 views you want to alternate), and when the user clicks the UIPageControl, you would set the contentOffset of the UIScrollView.
Makes sense?

scrollViewDidScroll not executing

I think have decent experience working with iPhone development.
as much I know.. I did set up the delegate..
I have from top to botton
UIView --> UIScrollView--> UITextView
I tried everything... to get the event scrollView to fire the scrollViewDidScroll event.
is anything wrong with the structure..
there not much of the code to post here.
what I am trying to do is.. do something when UITextView is scrolled.
Sorry did not respond... Just wanted to share in case anyone need this...
I used delegate methods of parent i.e. UIView for UIScrollView i.e. Child it worked..
It's hard to say without some code or a screenshot. Is the scroll view actually scrolling? If you set it up in Interface Builder, did you change the size of the scroll view's contentSize in code so that it can actually scroll? Maybe the text view is eating the scroll events; did you try setting the text view's delegate to see if it's firing a scrollViewDidScroll event?