Cannot Impliment UITextview inside a UIPageViewController - iphone

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

Related

UITextView interferes scrolling of UIScrollView

The problem I am encountering now is that there is a UITextView component in UIScrollView and that UITextView component will interfere the scrolling of UIScrollView, i.e. when a user's finger is on that UITextView to scroll the whole UIScrollView, the screen won't scroll. The content in the UITextView is dynamic, i.e. the size of UITextView component is dynamic. The worst case is the whole screen is occupied by the UITextView and users won't be able to scroll the screen at all.
The UITextView is disabled for editing. I choose UITextView instead of UILabel because I want to detect phone number & link in the supplied text and utilize the built-in function to invoke dialer and browser when users click the phone number or link.
Any suggestion about how I can solve this problem or any clue about why this happens are all appreciated! Thanks.
UITextView inherits from UIScroll view so it has a property scrollEnabled. Just put it to false!
If you are using a storyboard or nib file, select your UITextView and uncheck Scrolling Enabled in Interface Builder.
Otherwise, do this:
textView.scrollEnabled = NO;
Apart from the property scrollEnabled, you also have the property userInterationEnabled that disable(if you set it to FALSE/NO) any touch events on the view (scrolling included, of course). Hope it helps, specially for other situations cos in your case it makes the same effect as disabling the scroll.

Canceling the scrolling animation when keyboard pops up on iphone

I have a UIViewController that contains UITextField. I set the inputAccessory of the textfield to a UIToolbar that I create.
My ViewController's view is inside a UIScrollView (To handle the events of keyboard popping up)
Before:
Now, when the keyboard pops up, suddenly my ScrollView is setting it's contentOffset.y to 64 with animation, so part of my view is pushed above the top of the screen:
After:
This is done by the framework because I'm using a toolbar for inputAccessoryView.
If i'm dropping the toolbar there is no animation and no content offset.
Is anyone knows how can I disable this automatic animation and scrolling?
Thank you!
You can use a combination of boolean flags and your UIScrollViewDelegate to prevent the scrolling from taking place. Scroll view delegates can be used to detect when scrolling is taking place, modify the type of scrolling, and also simply prevent it from happening, so your best approach is probably to look into detecting when the keyboard goes up (via a notification or text field delegate, whichever is more appropriate) and using that in combination with your scroll view delegate.

How to scroll to UITextField placed into a UITableView

I've got an UIScrollView with an UIImageView at the top and an UITableView.
inside every cell of the UITableView I've placed a UITextField
I would like to know how I can automatically scroll to the UITextField selected so that it doesn't go under the keyboard
I've already looked at this Get UITableView to scroll to the selected UITextField and Avoid Being Hidden by Keyboard but it doesn't works very well for my situation..
could you help me?
Thank You!
Check out Matt Gallagher's fantastic Sliding UITextFields around to avoid the keyboard. It ought to be just what you need. You can modify it to only scroll a specific element, or just leave it as is to scroll the whole superview.

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?

UIPageControl tap to "swipe"?

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.