iOS ObjectiveC: Support Right To Left
To support the Right To Left on my app, I'm using this instructions:
[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[[UIStackView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[UITextView appearance].textAlignment = NSTextAlignmentRight;
But I have a lot of problems:
-I don't understand how to refresh the UI if I need to apply the new alignment in the current view.
-In a collection view the alignment doesn't change even if I use:
[[UICollectionView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
so I decided to use:
self.sectionsCollectionView.transform = CGAffineTransformMakeScale(-1, 1);
and:
cell.transform = CGAffineTransformMakeScale(-1, 1);
It works, but if I push another view and after I pop to the view with the collection view, it's again aligned to the left until I tap into the section header, after the tap it goes to the right.
ios objective-c right-to-left arabic-support
add a comment |
To support the Right To Left on my app, I'm using this instructions:
[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[[UIStackView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[UITextView appearance].textAlignment = NSTextAlignmentRight;
But I have a lot of problems:
-I don't understand how to refresh the UI if I need to apply the new alignment in the current view.
-In a collection view the alignment doesn't change even if I use:
[[UICollectionView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
so I decided to use:
self.sectionsCollectionView.transform = CGAffineTransformMakeScale(-1, 1);
and:
cell.transform = CGAffineTransformMakeScale(-1, 1);
It works, but if I push another view and after I pop to the view with the collection view, it's again aligned to the left until I tap into the section header, after the tap it goes to the right.
ios objective-c right-to-left arabic-support
add a comment |
To support the Right To Left on my app, I'm using this instructions:
[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[[UIStackView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[UITextView appearance].textAlignment = NSTextAlignmentRight;
But I have a lot of problems:
-I don't understand how to refresh the UI if I need to apply the new alignment in the current view.
-In a collection view the alignment doesn't change even if I use:
[[UICollectionView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
so I decided to use:
self.sectionsCollectionView.transform = CGAffineTransformMakeScale(-1, 1);
and:
cell.transform = CGAffineTransformMakeScale(-1, 1);
It works, but if I push another view and after I pop to the view with the collection view, it's again aligned to the left until I tap into the section header, after the tap it goes to the right.
ios objective-c right-to-left arabic-support
To support the Right To Left on my app, I'm using this instructions:
[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[[UIStackView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
[UITextView appearance].textAlignment = NSTextAlignmentRight;
But I have a lot of problems:
-I don't understand how to refresh the UI if I need to apply the new alignment in the current view.
-In a collection view the alignment doesn't change even if I use:
[[UICollectionView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
so I decided to use:
self.sectionsCollectionView.transform = CGAffineTransformMakeScale(-1, 1);
and:
cell.transform = CGAffineTransformMakeScale(-1, 1);
It works, but if I push another view and after I pop to the view with the collection view, it's again aligned to the left until I tap into the section header, after the tap it goes to the right.
ios objective-c right-to-left arabic-support
ios objective-c right-to-left arabic-support
edited Dec 28 '18 at 2:45
Scott McKenzie
7,49873560
7,49873560
asked Dec 27 '18 at 20:15
user1759226
185
185
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
As per Apple's documentation,
By default, text alignment in iOS is natural; in OS X, it’s left.
Using natural text alignment aligns text on the left in a
left-to-right language, and automatically mirrors the alignment for
right-to-left languages. For example, if you set the alignment of an
NSMutableParagraphStyle
object using the setAlignment: method, pass
NSNaturalTextAlignment
as the parameter.
[[(NSMutableParagraphStyle *)paraStyle setAlignment:NSNaturalTextAlignment];
However, if you want to align a control to the right in a
left-to-right language (and to the left in a right-to-left language),
get the layout direction, as described in Getting the Layout
Direction, and set the alignment toNSLeftTextAlignment
for a
right-to-left language.
For more details, please refer Supporting Right-to-Left Languages
This is what I did, but it's not working on this view. !Video.
– user1759226
Dec 27 '18 at 22:52
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53950394%2fios-objectivec-support-right-to-left%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As per Apple's documentation,
By default, text alignment in iOS is natural; in OS X, it’s left.
Using natural text alignment aligns text on the left in a
left-to-right language, and automatically mirrors the alignment for
right-to-left languages. For example, if you set the alignment of an
NSMutableParagraphStyle
object using the setAlignment: method, pass
NSNaturalTextAlignment
as the parameter.
[[(NSMutableParagraphStyle *)paraStyle setAlignment:NSNaturalTextAlignment];
However, if you want to align a control to the right in a
left-to-right language (and to the left in a right-to-left language),
get the layout direction, as described in Getting the Layout
Direction, and set the alignment toNSLeftTextAlignment
for a
right-to-left language.
For more details, please refer Supporting Right-to-Left Languages
This is what I did, but it's not working on this view. !Video.
– user1759226
Dec 27 '18 at 22:52
add a comment |
As per Apple's documentation,
By default, text alignment in iOS is natural; in OS X, it’s left.
Using natural text alignment aligns text on the left in a
left-to-right language, and automatically mirrors the alignment for
right-to-left languages. For example, if you set the alignment of an
NSMutableParagraphStyle
object using the setAlignment: method, pass
NSNaturalTextAlignment
as the parameter.
[[(NSMutableParagraphStyle *)paraStyle setAlignment:NSNaturalTextAlignment];
However, if you want to align a control to the right in a
left-to-right language (and to the left in a right-to-left language),
get the layout direction, as described in Getting the Layout
Direction, and set the alignment toNSLeftTextAlignment
for a
right-to-left language.
For more details, please refer Supporting Right-to-Left Languages
This is what I did, but it's not working on this view. !Video.
– user1759226
Dec 27 '18 at 22:52
add a comment |
As per Apple's documentation,
By default, text alignment in iOS is natural; in OS X, it’s left.
Using natural text alignment aligns text on the left in a
left-to-right language, and automatically mirrors the alignment for
right-to-left languages. For example, if you set the alignment of an
NSMutableParagraphStyle
object using the setAlignment: method, pass
NSNaturalTextAlignment
as the parameter.
[[(NSMutableParagraphStyle *)paraStyle setAlignment:NSNaturalTextAlignment];
However, if you want to align a control to the right in a
left-to-right language (and to the left in a right-to-left language),
get the layout direction, as described in Getting the Layout
Direction, and set the alignment toNSLeftTextAlignment
for a
right-to-left language.
For more details, please refer Supporting Right-to-Left Languages
As per Apple's documentation,
By default, text alignment in iOS is natural; in OS X, it’s left.
Using natural text alignment aligns text on the left in a
left-to-right language, and automatically mirrors the alignment for
right-to-left languages. For example, if you set the alignment of an
NSMutableParagraphStyle
object using the setAlignment: method, pass
NSNaturalTextAlignment
as the parameter.
[[(NSMutableParagraphStyle *)paraStyle setAlignment:NSNaturalTextAlignment];
However, if you want to align a control to the right in a
left-to-right language (and to the left in a right-to-left language),
get the layout direction, as described in Getting the Layout
Direction, and set the alignment toNSLeftTextAlignment
for a
right-to-left language.
For more details, please refer Supporting Right-to-Left Languages
answered Dec 27 '18 at 20:29
Bappaditya
1,432715
1,432715
This is what I did, but it's not working on this view. !Video.
– user1759226
Dec 27 '18 at 22:52
add a comment |
This is what I did, but it's not working on this view. !Video.
– user1759226
Dec 27 '18 at 22:52
This is what I did, but it's not working on this view. !Video.
– user1759226
Dec 27 '18 at 22:52
This is what I did, but it's not working on this view. !Video.
– user1759226
Dec 27 '18 at 22:52
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53950394%2fios-objectivec-support-right-to-left%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown