Text

Answered

How to get text iOS

When i draw the "A" letter can i get that text  after recognition for show in my custom UITEXTVIEW in iOS SDK?


Best Answer

Dear Kannan,


did you try changing the font-size parameter: https://developer-support.myscript.com/support/discussions/topics/16000026063 ?


Let us know if this helps.


Best regards,


Olivier


Answer

Dear Kannan,


did you try changing the font-size parameter: https://developer-support.myscript.com/support/discussions/topics/16000026063 ?


Let us know if this helps.


Best regards,


Olivier

Hi Olivier,  

Actually i want to import the text into the writing area by following code,

try editorViewController.editor.import_(.text, data:"Sample Text", block: nil)

But the text size was too large.How can i reduce that text?

Dear Kannan,


when you say that imported text is too large, I am not sur to understand:

-Are you using the "import" function, and the length of the text that is imported is much longer than your field can afford?

-Or you are using a batch mode and the strokes are too big?

-Or anything else?


Best regards,


Olivier

Hi Olivier,

Thanks for your response.

 Imported text size was too large.Can i change that imported text's size to small?


Dear Kannan,


please follow the instructions given by Gwenaelle, i.e. you cannot use the UI Reference implementation as it is, since it uses "UIViewController".


Please note we will not update your code, the idea is that we help you when you have questions, not that we develop for you.


Best regards,


Olivier

Hi Gwelnaelle, I was lookup that above link.But i didn't get any solutions for that(Rendering). I have attached my project source code Github link below here, https://github.com/kannan333/hello-world.git Can you help me?

Hi Gwelnaelle,

I was lookup that above link.But i didn't get any solutions for that(Rendering).

I have attached  my project source code Github link below here,

https://github.com/kannan333/hello-world.git

Can you help me?

Hi Kannan,


It looks like you are having a problem with your rendering.

Please take a look at https://developer.myscript.com/docs/interactive-ink/1.3/ios/fundamentals/rendering/#layer


Best regards,


Gwenaëlle

Hi Gwelnaelle,

Above my query was solved.But I have another problem.

My writing view(EditorViewController's View) was imported in my UITableviewCell.

1) When i draw something in my writing view there are no drawing lines was formed in writing view.But editor engine show the letters what i draw in writing view.

Ex:If i draw letter "A" there are no sketch line was formed in writing view but my editor engine show the letter "A".

2) If i put that writing view in my UITableviewCell and i draw the some letter on vertical type at that time UITableview was scroll to bottom.I can't able to write the any letter in that writing view because UITableview's scroll was activated when i try to draw something in writing view.

how can i solve this two issues?


Hi Gwelnaelle,

Thanks for response.

Yes ,we can't add the UIViewController to the UITableViewCell.

But we can add the UIViewController's View.Add that EditorViewController's View But it doesn't make any change in UITableviewCell.(Only Blank page showed in UITableviewCell.Didn't show any lines)

My "CellForRowAtIndexPath"(Tableview Datasource method) Code was:

 var cell: WritingSummaryNewTableViewCell? = (tableView.dequeueReusableCell(withIdentifier: "WritingSummaryNewTableViewCell") as? WritingSummaryNewTableViewCell)

 let storyboard = UIStoryboard(name: "Main", bundle: nil)

 cell?.editorVC  = storyboard.instantiateViewController(withIdentifier: "EditorViewController") as! EditorViewController

 self.addChildViewController(cell!.editorVC )

 setupEditorsVC(editorsVC: cell!.editorVC)

 cell?.writingBase_View.addSubview(cell!.editorVC.view)

 cell?.editorVC.didMove(toParentViewController: self)

 cell?.writingHgt_Constrnt.constant = 200

setupEditorsVC Function Code Was:

 var getVC = editorsVC

 getVC = childViewControllers.first as! EditorViewController

 let appDelegate = UIApplication.shared.delegate as! AppDelegate

 getVC.engine = appDelegate.engine

 getVC.inputMode = .forcePen

  do {

        if let package = try createPackage(packageName: "New") {

           try getVC.editor.part = package.getPartAt(0)

 }

} catch {

 print("Error while creating package : " + error.localizedDescription)

 }

   getVC.editor.delegate = self


What's problem in my method.How can we achieve that feature?




Dear Kannan,

This error is due to the fact that "UITableViewCell" cannot contain "UIViewController".

So if you want to use "iink" in "UITableView", you cannot use the UI Reference implementation as it is, since it uses "UIViewController".


You have to implement your own UI implementation and replace all "UIViewController" by "UIView".

Regards,

Gwenaëlle

Hi Olivier,

Thanks for your response.

Ok Olivier, we will implement that feature in next version of our app.I have one more doubt olivier.

I want to insert the writing view in my "UITableviewCell" But if i implement that it throughs the error "Container Views cannot be placed in elements that are repeated at runtime."

How can i insert writing view(Container View) in my UITableView. 

Is there is anyway to achieve that?


Hi Olivier,

Thanks for your response.

Ok Olivier, we will implement that feature in my next version of our app.I have one more doubt olivier.

I want to insert the writing view in my "UITableviewCell" But if i implement that it throughs the error "Container Views cannot be placed in elements that are repeated at runtime."

How can i insert writing view(Container View) in my UITableView. 

Is there is anyway to achieve that?



Dear Kannan,


Currently, how did you implement your renderer? If similar to the one we provide in the samples, then we update the layers in the "onDraw" function of the LayerView class.


One idea I came up with is that you decide by yourself when updating the "MODEL" layer (you update the onDraw function accordingly), i.e. call the renderer.drawModel when you want to display the "TEXT" one first line.


Let me know if this helps.


Best regards,


Olivier

Hi Olivier,

I can detect when they are stating the new line but my problem was i want to remove the only the first line and convert the first line into the "TEXT" then put into the first line instead of drawing texts.The second line remain as the drawing text mode.How can i achieve this?