Can a UITextView render from top to bottom?

In my next project, there is a requirement to display Japanese text, which is displayed from top to bottom and from right to left (traditional Japanese writing style). Is it possible to set UITextView text to layout in this way? The following is an example of some text written this way:

  WH OE RL LL DO ! , 

In addition, I need to be able to select it (so that UILabel missing). Is this going to turn into a completely ordinary performance?

+7
source share
5 answers

The answer, as it turns out, is "no, he cannot."

So, I built my own using Core Text, which is largely based on " SimpleTextInput ". The key to this view is adding YES to the kCTVerticalFormsAttributeName key. Fortunately, the logic of choice already exists in the project, it is simply not used. I could easily add it by calling the appropriate methods inside the pan gestures (there was some kind of monkey business with CTFrameGetLineOrigins rewriting part of its neighboring memory, but fortunately I was able to solve it).

+2
source

It still seems that you donโ€™t want such a custom style representation. If I were you, I would convert the typing of the Japanese language to adapt to the traditional Japanese style of writing (perhaps this is not a good idea, but it is possible)

possibly a text line: "YUQM I EAZVRNJFBWSOKGCXTPLHD".

By the way, are you good at arithmetic coding?

0
source

to snap to the left

  uiTextView.text = [NSString stringWithFormat:@"\u202B%@",textString]; 
-one
source

you can try this ...

 - (void)loadView { [super loadView]; CGRect frame = CGRectZero; frame.size = self.view.frame.size; UITextView* tv = [[UITextView alloc] initWithFrame:frame]; [self.view addSubview:tv]; tv.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; tv.text = [_value description]; tv.editable = NO; tv.dataDetectorTypes = UIDataDetectorTypeAll; // default font size is too small tv.font = [UIFont systemFontOfSize:[UIFont labelFontSize]]; [tv release]; } 
-one
source

If you only want to move the text, try

[textViewTest setContentInset: UIEdgeInsetsMake (<#CGFloat top #>, <#CGFloat left #>, <#CGFloat bottom #>, <#CGFloat right #>)];

If a positive number moves the frame toward the middle, a negative number moves it out of the middle.

For example, [textViewTest setContentInset: UIEdgeInsetsMake (-5, 0, 5.0)] will move the text 5 pixels up!

-one
source

All Articles