I am working on an app which I have just released an iOS7 version of. In the app I have a table view that contains text feilds in each cell. The problem is that when I tab to edit a feild that is near the bottom of the screen the keyboard appears and I cant see what I'm typing. I fixed this in iOS6 by simple listening for the event of the keybaord appearing and changing the size of the tableview so that it no longer extended to the bottom of the screen, but instead only reached to the top of they keyboar. The table view would then "automatically" scroll so that the cell was visable. This worked fine in iOS6 but as soon as I made the switch to iOS7 this no longer works... it no longer "automatically scrolls" when I change the size of the table. Does anyone know if there is a property that I need to set or something to "re-enable" this functionality?
Related
TL;DR
Is it a new feature in Xcode 14 and iOS 16 that a UIScrollView is now scrolled automatically when a view inside the ScrollView becomes firstReponder and the keyboard appears? While working on other iOS projects in earlier versions of Xcode and iOS I never came across this behaviour. Can this be controlled or deactivated?
Details:
While working with Xcode 14.0.1 on a new iOS project I noticed that an UIScrollView is now automatically scrolled when the content view becomes first responder.
Have a look at this example. I have created a new project, added a ScrollView to the ViewController and placed 12 subviews inside to fill it with some content. Subview no. 12 additionally holds a UITextField. The firstResponder status of this text field can be toggled using the top button.
When tapping on the button the TextField becomes firstResponder and the ScrollView is automatically scrolled up. However, not enough to make bring the TextField above the keyboard and make visible. Just enough to bring it above the bottom screen edge.
This does not make a lot of sense to me.
Is it possible to control this automatic scrolling or to deactivate it?
EDIT:
I have created CustomScrollView as UIScrollView subclass and did override scrollRectToVisible. When calling super.scrollRectToVisible everything works as before, but I could set a break point to see from where scrollRectToVisible is called.
The callstack shows the method scrollTextFieldToVisibleIfNecessary inside UITextField which uses delegateShouldScrollToVisibleWhenBecomingFirstResponder
However, UITextFileDelegate does not have such a method / value and scrollTextFieldToVisibleIfNecessary is also documented nowhere.
So, the question remains: How to disable this behaviour?
I have implemented two different tableviews. The first uses a UIViewController and a UITableView. The second uses a UITableViewController with static cells.
I currently have prefersLargeTitles = true. On the first view controller, the navbar expands as I drag down the table as expected. However, after I scroll up making the navbar shrink, letting go and pulling down on the table again does not expand the navbar and it seems to be "stuck" after that.
This is not an issue on the second controller that uses a UITableViewController.
This issue does not occur on the simulator, but has occurred on two different iPhone 7's (iOS 11.2 beta 4, iOS 11.1.2)
As you can see below, after I go to scroll back down after scrolling up, there is a slight jolt then it sticks. The navbar no longer expands after this point (it does collapse still).
Here is an example of what should occur and happens with the UITableViewController.
Is this an iOS 11 issue?
I have two questions regarding WatchKit:
1) I have an app that uses [WKInterfaceTable]. One of the interfaces is scrollable.As such, when the user scrolls, the scroll bar appears in the top right corner of the watch interface.
How do I get the scroll bar to temporary flash the scroll bar when the user opens the app. A good example of this functionality is the Calendar app in Apple watch.
I've combed the net and WatchKit catalog (https://developer.apple.com/library/ios/samplecode/WKInterfaceCatalog/Introduction/Intro.html) but was not able to find a solution.
2) I have another interface that only shows one row on the watch and therefore does not need to scroll. How do I remove the scroll view in this case?
I am using WatchKit 2.0 and writing the app in Objective-C.
I wonder if you could get the desired effect by scrolling to the top programmatically after the view has loaded?
table.scrollToRowAtIndex(0)
If that didn't work, then perhaps (again after load) scroll to the second row and then back to the first to cause the bar to display?
table.scrollToRowAtIndex(1)
table.scrollToRowAtIndex(0)
I haven't tried this, but I have programmatically traveled to rows in a WKInterface table and I believe you do get the scroll bar.
I have a universal app using auto layout, but for unknown reason, the constraint I have on the UIButton is causing the button to not respond on iPhone (works perfectly fine on iPad). Below is the snapshot of my .xib view that will eventually get embedded inside another UIScrollView.
Note that "(read drug facts...)" is my standard UIButton that doesn't respond to click on iPhone. However, when I changed the top spacing between Dose label and Body View, then it responded to clicks. But, when I reduced the spacing constant from 40 down to 10 then the button won't respond anymore. I don't see view that is invisibly hiding the button.
UPDATE 1:
Thanks Matt for reminding me of the great view debugging feature which I've forgotten about. Even with the view debugging, I'm unable to find its culprit. Please see images below.
I have simple collection view created programmatically with build in horizontal layout and 50 items. When I enable VoiceOver to speak content of each cell, scroll position is changed to beginning on first item.
I would like to preserve scroll position. Am I missing something when VoiceOver is enabled?
With voice over disabled it works without issues.
Good to mention it works without issues on iOS7. I am using xcode 6.