How do I align elements right-to-left in a BlackBerry HorizontalFieldManager?
On JDE 6.0, if you want to do this for locale reasons, then setting the HorizontalFieldManager.LOCALE_AWARE_LAYOUT style bit will cause left-to-right or right-to-left, depending on the user's locale.
The HorizontalFieldManager docs for BlackBerry JDE 6.0 mention a style bit Field.LEFT_TO_RIGHT and Field.RIGHT_TO_LEFT, but I don't see those constants in Eclipse, so that may be a documentation bug.
HorizontalFieldManager adds fields from left-to-right by default. In the following example, the three labels are aligned in one row from left to right.
HorizonatalFieldManager hManager=new HorizonatalFieldManager();
LabelField l1=new LabelField("Label1");
LabelField l2=new LabelField("Label2");
LabelField l3=new LabelField("Label3");
hManager.add(l1);
hManager.add(l2);
hManager.add(l3);
Related
My problem is that I have to two UITextView displaying different Text, but always the same number of characters. I could not find a way to set a fix character-width and space width in UITextView/NSAtrrStr/UIFont.
Is there a way to do that?
thanks
As far as I know, Courier New is the only fixed-width font shipped with iOS.
Also, you can always import custom fonts to your xcode project which you know are fixed-width. Here is how: Embed Custom Font in iOS
I am creating an app that will be in English and Arabic. I am using my own localization system because I want to allow users to switch languages themselves from within the app and while the app is running (I am not aware of a way how to do this official Apple way). I would like to switch entire app to right-to-left when user picks arabic language, i.e. switch trailing and leading, text alignment etc.
Is this even possible?
EDIT: I am targeting iOS 7+
Yes, this is possible. From what I am understanding you want to move all of your components to the opposite side and also the text should be written from the right, right?
First of all, you have to set your language to the "AppleLanguage" key in user defaults:
NSUserDefaults.setObject(["ar"], forKey: "AppleLanguage")
Then you have to use auto layout. By default auto layout detects the region depending on the language chosen and when you've set leading and trailing spaces correctly, it will change the position of your text fields for example. If you want some of your components to stay on the same place, you have to use "left" instead of "leading".
If you need to change the direction of app to LTR & RTL then you could use that solution.
//FOR RIGHT TO LEFT
UIView.appearance().semanticContentAttribute = .forceRightToLeft
//FOR LEFT TO RIGHT
UIView.appearance().semanticContentAttribute = .forceLeftToRight
Hope this will solve your problem.
Reference: https://stackoverflow.com/a/48963618/8809657
Hello I'm making the Add button for my iOS project. It has to use material style, so i've found BFPaperButton project on github. Now I need to find font where plus sign is vertically and horizontally centered. I've try many fonts, but not all. The most suitable is Times New Roman. Maybe someone now better font for my goal? I think if UIBarButton System items have their font - Add symbol has to be suitable, but I can't find it.
P.S.: Text in button centered
Here is an image of what I already have.
https://pp.vk.me/c622128/v622128875/1e805/D5K67mtyA50.jpg
And what I have to make
https://pp.vk.me/c622128/v622128875/1e80c/y0_W11kTl-0.jpg
P.P.S. I'm sorry for my English, I'm trying to write question without any translators.
Just used
contentEdgeInsets = UIEdgeInsetsMake(-12, 0, 0, 0);
It helped.
As per apple documentation
"iOS doesn’t automatically mirror controls, so if you want this behaviour for an iOS app, subclass the control and override the drawing methods."
I want to mirror my whole UI when the user selects the language as Arabic or hebrew in the home screen. i was searching for tutorials and documentation for the same but nothing helps.
Please find what i have done till now:
am using Xcode 6.1 and the app targets from iOS 7 to iOS 8.1.
Autolayout is enabled and am not using left or right constraints. am using only leading or trailing constraints.
Base internationalisation is enabled in project settings also have added the languages in localization. but when am running the app in device and set device language and region to arabic i cant get the mirrored UI. Do i have to do anything in code to get the mirrored UI?
What is the best way to support RTL based UI? How to subclass control and override drawing methods?
Please use this link to get the sample screenshot of my app.
I just found a easy way from Apple documentations instead of having 2 storyboards for RTL and LTR languages.
First of all enable Base internationalisation in project settings
Add your language - in my case i have added arabic and hebrew
xCode will localize your stroy boards and you can see different storyboard strings for different languages
Change the texts for your labels in the newly created strings file. In my case i changed in arabic and hebrew string files
Use AutoLayout for designing the whole UI.
Don't use Left or right constraints. Instead of use only leading and trailing constraints
Add the below code in your main function and run the app in simulator
NSArray* languages = [NSArray arrayWithObjects:#"ar", nil];
[[NSUserDefaults standardUserDefaults] setObject:languages forKey:#"AppleLanguages"];
Your app now will work for RTL language with mirrored UI without having 2 storyboards.
Note : if you are not setting the autolayout constraints correctly it wont work. However because of the new screens you have to learn to use auto layout.
in Swift
let languages = ["ar"]
UserDefaults.standard.set(languages, forKey: "AppleLanguages")
I'm not sure where to begin, but I've been trying to find a similar class that allows me to create a scrollable list where I can add images and text.
I found a tutorial using PictureScrollField, but I dont think that is what I need. Is FlowFieldManager the closest thing?
Edit:
I see that there is a tableView class in Blackberry. However, it says BlackBerry API 6.0.0, so does that mean it won't work with bb's 5.0?
For BlackBerry, typically you use a ListField to build a scrollable list. It does have some constraints though: Each item needs to have the same height, and you have to do all the drawing yourself, instead of using the more typical field + manager layout used for BlackBerry screens. The upside of those constraints is that the drawing performance is quite good.
I used FieldManager classes to do this. As an example you can use:
net.rim.device.api.ui.container.VerticalFieldManager.
And for images I have used following kind of code.
InputStream inputStream = connection.openInputStream();
byte[] data = IOUtilities.streamToBytes(inputStream);
EncodedImage img = EncodedImage.createEncodedImage(data, 0, data.length);
img.setScale(3);
imgOK.setImage(img);
In following link some specified Layouts are available OS5.0 also
like table view,grid view and spreadsheet layouts
just copy paste that class into your project then you can use this
using TableModel-TableView-TableController
GridTable-SpreadSheet-layout-manager
if it is not useful to you just ignore this