I have been working on (xamarin.android) project using percentrelativelayout and have come across a problem. When the soft keyboard is displayed it squishes the entire layout. Is, there a way to resolve this? Like how to set the keyboard on top of the layout.
I solved it by adding a tag in the mainactivity.cs file "WindowSoftInputMode = SoftInput.AdjustPan".
Related
Please consider this example on iOS: https://sketch.expo.io/SyeyMSx_il
Try to scroll manually, everything looks normal: No comments message stays on top.
If you click now on the button now, the No comments message sticks to the bottom.
If you scroll manually again, everything goes normal again.
Why using scrollToEnd should be different than scrolling manually? And how to fix this weird behaviour?
Adding to ScrollView contentContainerStyle={{ flexGrow: 1 }} fixed that.
See now: https://snack.expo.io/HkdP9_e1Z
I'm not sure of the cause of the behaviour without digging through the source code for ScrollView but you could get around it by making a function that handles the scroll to end, only triggering it if the size of the contents are greater than the size of the viewport.
After the update to Xamarin.iOS 10.2 and iOS SDK 10.2, the UISwitch in my app seems to be hardly tappable (works only if I tap inside the red circle, in the image below).
Moreover the label (to the right of it) appears ON it despite it has a constraint which should place it at 10 from UISwitch.
The entire layout is made with storyboard.
Anyone could help me? I've tried everything.
Thanks in advance
EDIT
I was able to resolve this by removing these two components and adding them again. The update seems to has messed up the layout.
I was able to resolve this by removing these two components and adding them again. The update seems to has messed up the layout.
It looks like the UILabel is in front of the UISwitch.
Either set the UILabel to not take user input by using this:
myLabel.UserInteractionEnabled = false;
or fix the constraint by posting more information on the constraint or uploading the xib/storyboard file.
I am trying to disable AutoLayout for one exact view called conversationVC.
As it is a chat and I got the code from a project which is not using Autolayout.
My idea was to use
self.view.removeConstraints(self.view.constraints)
self.view.translatesAutoresizingMaskIntoConstraints = true
to remove AutoLayouts constraints and add my own ones from CGRectMake
For some reason the screen gets messy.
This is my view hierarchy:
This is what the screen looks like using no code at all to remove AutoLayout:
Now trying to remove and Autoresize all single Items in my View it looks like this:
As you can see certain views become missing.
Any idea how to overcome this behavior?
note: add button is in the correct position.
Edit: It is not a duplicate since it addresses the whole view and it's elements other than a single label. also i don't think Autoresizing is the problem, but something else
I'm still getting familiar with iOS and the use of constraints. Initally had my layout setup with some constraints. But I ran into an issue. When entering text, my text fields are covered by the keyboard. I found some Apple docs: Doc One, Doc Two stating I should use a scrollviewin this case. It sounded easy enough but every time I put the content in the scrollview things go nuts. I've tried adjust my constraints in several ways, but nothing seems to help.
Anyone have any insight on what I'm missing?
Thank you
Before adding the Scrollview
After adding the Scrollview
If you use a UITableView with static cells and make your view controller a subclass of `UITableViewController, you don't need to worry about the keyboard. The table view controller takes care of keeping the focussed text field visible above the keyboard:
I wrote no code for that demo. It's all done in the storyboard. Here's the storyboard outline:
Would someone be so kind telling me how would you set a constrain (using size classes) for a view to be right above the keyboard (without the predictive part) on iP6 and iP6+ like on the photo below?
May I have a sample project?
Thank you
Either add the constraints in programmatically based on the keyboard size, or make separate interface files for every screen size with a fixed constraint based on a known size for the keyboard for that screen.
Below is a link to a chat application that works from the same premise. When the keyboard is active elements are pushed up so they aren't hidden by it.
https://github.com/oseparovic/MessageComposerView
The application is in Objective C and pretty easy to transfer that section of the app, I've used this myself.