Giter Site home page Giter Site logo

Supporting UITextView about molh HOT 6 OPEN

moathothman avatar moathothman commented on September 24, 2024
Supporting UITextView

from molh.

Comments (6)

AhmadFayyas avatar AhmadFayyas commented on September 24, 2024 2

According to my experiments for tracing the issue, it seems that UIKeyInput components alignment does not get affected by semanticContentAttribute. Note that not all components with textAlignment have this issue since the UILabel responds to semanticContentAttribute effect iff its textAlignment is natural, however even if the textAlignment for a UIKeyInput is natural it won't change its alignment.

In general, there are similar issues related to this one, for instance: Skyscanner/SkyFloatingLabelTextField#109.

So far, we have to explicitly change textAlignment for the UIKeyInput components.

@MoathOthman please advice.

from molh.

AhmadFayyas avatar AhmadFayyas commented on September 24, 2024 2

Ok, so let's split the issue to make it more clear.

For the text field:

is this the expected result?
apr-30-2018 14-52-31

At some point we could change the alignment of the placeholder itself and enforce the text alignment to be the desired one, regardless of what's the used language.

For the text view:

obviously, there is no placeholder by default. I assume that the fix should be to enforce it to the desired text alignment...

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024 1

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

@AhmadFayyas thank you for your insights , that seems legit since the the direction of the text should depends on the direction of the user input , yet what we are trying to solve here is a bit different since we just need to make the placeholder alignment looks the same as with the other components.(my bad wrong acceptance criteria, will fix it @AhmadFayyas )
currently its applied to the uitextField, but its not perfect though .

for subview in self.subviews {
            if let label = subview as? UILabel {
                label.tag = self.tag
            }
        }

the issue with the above code is that it will change the direction once the user start editing to the wrong direction ,

we have to explicitly change textAlignment for the UIKeyInput components
is that possible ? .

from molh.

alielephant avatar alielephant commented on September 24, 2024

I am facing the same issue.
When I switch the language to Arabic and I use English keyboard; the cursor will start from LTR instead of RTL. However, it will start from RTL when I change my keyboard language to Arabic. Any solution to fix that?

I found a solution but it will be a repeating code for every view in the storyboard.

If the app is Arabic, it will use the following code:
textfield.textAlignment = .right
If the app is English, it will use the following code:
textfield.textAlignment = .left

Any chance to use a function that will update all the textfields and textviews alignment in the application after changing the language?

from molh.

MoathOthman avatar MoathOthman commented on September 24, 2024

@alielephant its tricky one , if you have a fix please don't hesitate to submit a pr.

from molh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.