Swift UITableViewTable Footer moving up with keyboard - ios

I'm developing a "pitch 'n putt" score card app (it's going to change the world). Except I've been pulling my hair out over using the UITableViewFooter.
When I click the player name, the keyboard appears but this is pushing the Footer up with the keyboard ,The overall effect does not look very good.
I've attached some screen shots which hopefully explain it better.
Is there a way to disable this behaviour?
Step 1 - Click Name
Step 2 - Keyboard appears and score totals are moved up as well.

I've turned into one of those guys that posts a question and solves it.
Anyway, in case it helps anyone else here is what I did.
1 - Create a global variable of
var playerFooter: UIView?
2 - in my func tableview (... viewForFooterInSection...)
just before my return
playerFooter = containerView (whatever you are returning)
3 - Add a notification for Keyboard show/hide and in side call
playerFooter!.hidden = true (or false depending on the notification)
It works great! but I won't claim this is the most efficient way of doing it.
When the keyboard appears the section disappears, when the keyboard disappears the footer reappears.
Thank you.

Related

UITableView: Can't find a way to move/align the tableIndex element up

I have a UITableView and I am using a tableIndex, my problem is that when the keyboard comes up, it partially hides the tableIndex.
An acceptable solution would be to move the tableIndex up (like what the Contacts App does) when the keyboard appears, and show the most of it, but can figure out a way to do this. Any ideas of code snippet I can try?
The way to do this is to register to Keyboard Will Show notification and then update the height of your controller's view. You could also embed everything in a scroll View so that once the keyboard rises, your view becomes smaller and scrollable.
It is honestly a bit annoying to set up, so, if you are open to using CocoaPods then IQKeyboardManager is probably your best bet which can be found here: https://github.com/hackiftekhar/IQKeyboardManager

How to get real time keyboard frame while using keyboardDismissMode = .interactive

so my situation is as follows: I have a collectionView which loads chat messages, and an inputBarView that contains a textview, a send button, and some buttons (text, photo, etc). Currently, I'm using notifications to track the keyboard as it appears and hides, and modify the inputBarView's bottom constraint to keep it on top of the keyboard. What I'm trying to implement is for the user to be able to swipe away the keyboard akin to how facebook an imessage do it (gif 1).
Gif 1 - the goal
Currently, if I set the keyboardDismissMode to .interactive and keep the notification handler, the keyboard follows the user's finger as it slides down (as it's supposed to), but the inputBarView doesn't move until the keyboard is hidden (gif 2).
Gif 2 - the issue
I have searched for a solution for this for the past couple of days but nothing has worked so far. There are multiple questions about this exact issue here, but they're all either outdated, workaround hacks, or pod recommendations. Is there way to track the keyboards frame while dismissing it using .interactive?

How to move a table content to the top of the screen?

I am still new to iOS and Swift and I am using Swift4 and Xcode9 to edit an iOS project which is made with a prior versions of Xcode and Swift (Xcode8 and Swift3). In the project there is a TableViewController used. So the problem is when I open the project in Xcode9 and run it, it shows some space on the top. I tried changing y values, but didn't work. My questions are,
How to solve the upper mentioned problem. (There is a question like this in Stack Overflow already. But it's not due to different Xcode version. But I even tried all the suggestions in the answers. But none of them worked for me.)
When there is a text label or something on the top of the table content, I can remove that space, from the top, but it goes to in between that label and the table added. And the label is unable to get a click action or something when it's moved to the top. How to solve that?
Any suggestion/ answer will be highly appreciated. Thank you!
You can try this
if #available(iOS 11.0, *) {
yourTableView.contentInsetAdjustmentBehavior = .never
}
Ok I'm going to attempt to answer your question but I wasn't totally positive since you didn't include any code or screenshots.
Firstly. If you mean that there seems to be a gap between where the tableView starts and where the first cell is displayed, this is correct. You can fix that by doing:
tableView.contentInset = .zero
this means that any content inside the tableView starts goes all the way to the edges.
Now for the label receiving touches. You want to look at user interaction enabled values on the storyboard:
Whenever you have views that stack on top of each other, the view UNDER will not receive touches if the view on top has user interaction enabled. If you want a touch to bleed through another view you either can
1) avoid the issue by not stacking views on top of each other (often unavoidable, like putting a label on a view and wanting the background view to do something)
2) turn off the user interaction on the view on top so the view on bottom gets the touch
tableView.setContentOffset(CGPoint.zero, animated: true)
this code will move

iOS UISlider not moving when I swipe, even though other UI elements are fine

I've created a simple xib file with three buttons and a UISlider.
When I start the app on my phone I'm able to tap the buttons no problem, but the UISlider is locked and doesn't move..
However if I keep trying to move it with my finger it eventually scrolls left and right fine, but only after about a minute of furious screen swiping..
I thought it might be because it was hidden behind something onscreen (not that there's anything for it to hide behind) so I did 'arrange -> send to front', but this doesn't help.
Does anyone know why it might be doing this?

Unable to implement UISlider for Accessibility option in iPad

i am trying to implement accessibility option in my book reader app. I have a slider(similar to ibooks) which is used for navigating between pages. i have seen this question posted by another user and implemented the same code in my app. Right now my slider is responding when i'm tapping on it. The voiceover is also speaking the label i have given in the code. But, the problem is that, i am unable to change the slider value and navigate to another page.. I dont know if it is the problem with my code or is it that i do not know how to replicate the gesture to change the value of the slider... Any help in this regard will be appreciated.... Thanku
Does the slider work with VoiceOver turned off?
If so, try swiping vertically up or down (top to bottom of display) after selecting the slider element with VoiceOver enabled.
Is it a UISlider, or something of your own devising? UISlider needs an actual vertical swipe once selected, and moves a pretty significant amount as a result — not a good experience for going to the next page.
If it's your own custom control, be sure you set UIAccessibilityTraitAdjustable.

Resources