I'm developing a small jetpack-compose demo chat app. So I need a bar at the bottom with a TextField and a Button to send, just like in WhatsApp.... I figured it would be best to use a Scaffold with a bottomBar.
The problem now is, the bottomBar, is hidden behind the keyboard, when the keyboard opens. Any way around this?
You probably should try to push your bottomBar by keyboard's inset, using Accompanist lib.
https://google.github.io/accompanist/insets/
Related
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
I'm trying to design (a "properly designed," not "hack") custom alert view. The view should attach itself to the top of the keyboard; sliding up with the keyboard (if there is an alert) or being hidden (if there is no alert).
The view should always "stick" to the keyboard... including, for instance, when the keyboard hides. In that case, the view should slide right down, out of sight, along with the keyboard.
Here's an example of what I'm trying to achieve (with an active alert):
I have originally thought about subclassing UIAlertView, but it looks like that is not recommended. And, after experimenting a bit, this is clearly a tricky task. I've got an alert that shows up but, it turns into problems staying in sync with the keyboard, and I haven't found a way to make it "track" with the motion of the keyboard... not smoothly.
Any ideas?
You can achieve this with inputAccessoryView of UITextField and UITextView. See Custom Views for Data Input chapter in Apple's "Text Programming Guide for iOS" for more information.
For example, a very simple red bar above the keyboard can be added with the following code:
let keyboardAlertView = UIView(frame:CGRectMake(0,0,320,44))
keyboardAlertView.backgroundColor = UIColor.redColor()
textField.inputAccessoryView = keyboardAlertView
I’d like to use a UIScreenEdgePanGestureRecognizer on the bottom edge of my display. The recognizer works perfectly if I set its edges to UIRectEdgeLeft or UIRectEdgeRight, but UIRectEdgeTop or UIRectEdgeBottom do not work – they’ve overridden by some UISystemGestureGateGestureRecognizer.
I’m actually trying to override the Control Center in the same way that Facebook Paper has managed to do – figured the screen edge pan may have been their trick. Paper allows you to scroll from the bottom screen edge to pull their menu up, and Control Center doesn’t pop up at all. It’s definitely possible, I’m just wondering how they’ve done it.
Any thoughts?
There is a trick that lets you prevent the accidental launch of the Control Center. Just disable the status bar. Then on swipe the user will be prompted whether the control centre have to be launched or not.
It won't be launched in a single swipe. Instead an arrow appears on the first swipe and the user need to click and drag the arrow to launch the control centre, hence prevent accidental launch. Use this code to disable status bar.
I don't know if it will work in your case and your gesture recognizer will be fired but I would give it a try.
You can disable the status bar using this delegate method:
- (BOOL) prefersStatusBarHidden
{
return YES;
}
Hope it helps.
I don't know what I'm doing wrong but because the Facebook app hides the status bar they happen have the same behavior as in all full-screen apps in iOS.
I have tested it multiple times - the Control Center does not pop up, but the little tiny arrow to bring it up - does.
So your assumption is wrong - Facebook didn't disable Control Center, nor did they override any behaviors. The just hid the statusBar across the whole app.
Just set the key value View controller-based status bar appearance to NO in plist. Then hide it.
And it is the way to go.
And BTW, when you swipe the apps view down to reveal your profile and the status bar appears - try to swipe up from the very bottom edge of the screen. Believe me, you'll be totally amazed.
There's no magic here, no nothing. Facebook are big but they can't defy iOS rules. And I'd like it to be that way, honestly.
Here's the video of the process:
http://www.youtube.com/watch?v=A2CWvhxhGoY&feature=youtu.be
How about using UISwipeGestureRecognizer instead?
Is there a possibility to change the button layout on a pre-made ios keyboard?
I would like to add "done" and "punctuation" buttons to numeric keyboard.
There is the Decimal Pad available but in this case i would have to add a custom done button at the top.
Is there a way to move the "delete" button to the right and make it half of its current width, put next to it the "decimal" button and on the former place of "delete" locate "done"?
No, you'll have to implement your own keyboard, if you duplicate the Apple one it will get rejected.
iOS does not support making those types of changes to the keyboard, the only thing you can do is change the text associated with the Done/Enter button by changing the UIReturnKeyType of the associated UITextField.
You can make a View With the buttons you want and set the inputView to the custom view you made ,, and you got a custom keyboard :D
You cannot directly modify the keyboard other than by choosing one of apple's presets. However, it is possible to add additional keys above it using -inputAccessoryView, like WolframAlpha has done in its app.
It looks like you can replace the keyboard entirely, but the accesory view is probably the way to go. See the answer to Adding key to IPad keyboard
EDIT: For an example of how this would look, check out WolframAlpha's blog post on the subject. In your case the accessory view probably won't be quite so tall
When using Safari and filling out a form, there are three buttons conveniently located at the top of the keyboard labeled Previous, Next, and Done. Is there a keyboard setting that can enable those or do you have to create and program these buttons manually?
I've had some success using this library:
https://github.com/simonbs/BSKeyboardControls
There is no default property of keyboard provided in ios. You need to add toolbar for that. Then you add previous , next or done UIBarButtons in the toolbar.
When keyboard appears toolbar is also displayed above it using some animation or directly same way when it hides/disappears you have to hide the toolbar also using animations or by changing it positioning in view.
Hope it helps you.
XCDFormInputAccessoryView is an accessory which contains the features you needed. It is easy to use. Here is how it looks with keyboard