Inserting Image into textField from customKeyboard - swift

I'm currently making my own customKeyboard Extension, i have Images as buttons which are to be printed into a text Field fx, imessages. So far I've been using
self.textDocumentProxy.insertText("text")
which inserts text but what func do i need to call to insert an image. The app joy emoji keyboard does this but i can't seem to figure it out.

Related

Show text and image in textview using sqlite as datasource

I want to display my data in flutter app as shown in below image. Also, all the data is stored in sqlite as shown below.
My content to be displayed like this image
All this content to be stored in sqlite as simple text as follows:
<h1><i>This is a heading:</i></h2><br/>This is a simple text which comes from the sqlite. An image comes between this text as below.<br/><img src="https://i.stack.imgur.com/hofuV.jpg"/><br/>This text comes after the image. All this data is tored as text in sqlite and to be shown in textview. So that searching and text resizing can be implemented too.
I tried htmlview but searching and text resizing functions not working in that case.
Help me please to implement this.
I tried using htmlview but searching and text resizing not working in that case.

Display Unobstrusive message on macOS using Swift

I need to display a text message on screen.
Currently I am doing this with a Text view on a transparent window, so the text is overlayed on the screen, perfectly.
The issue is that if am working on a text editor, or Excel, the popup shows up it blocks the text editor by an invisible rectangle around the text, i am unable to send mouse clicks or text keys to the window that i was working on.
I know there are ways to do it, some applications already do it, I just need to know how.
Take a look at this question. It is in Objective-C but the API details you need are there, you just need to do the equivalent in Swift. Whereas that answer draws a transparent red border you will draw your text transparent.

How to insert and delete image and text in one view just like MMS apps on iPhone

I would like to implement something like MMS app on iPhone, where user will have an option to include an image and text.
The way I did is i created a UIUiew and included a UITextView and UIImageView inside it, and when user selects an image it goes in to the UIImageView and the user can type in the UITextView.
But the problem that I am facing is once you insert a UIImage how do you put a cursor after the image so that user can delete(backspace) the image and that space free's up and it becomes available for the user to type in more text.
Simple answer: You cannot mix text and images in a UITextView. If you want to achieve a behavior like this, you should look into using Core Text to render the text yourself (it supports other elements inside the text via certain callbacks through which you tell the text system how much space it is supposed to reserve for the image.
To make the text editable, you would have to implement the text editing protocols UITextInput and UIKeyInput. Which means you have to basically write your own text editor. It's possible but it's a lot of work.

use tableview as uitextview

i want to develop a application like notepad app of iphone or ipod. i try my level best to design a uitextveiw like a paper with lines but it has a lot of problems like background image does not scroll with scroll of uitextview. and does not reapeat itself when text increases the background image.
its seems to me that the notepad app use a table view for taking input from user how i donot know.
so anyone who can tell me how to design a view like notepad app.
use a tableview and then place text field in each row such that if the text field limit reach the maximum length the next row text field become first responder. and when user click save then read data from all text field and then save it where u want.
but the only problem that i am facing is when the user past some data then i am unable to show that data in next text field if the past data is larger than the maximum length of a text field.
hope this help others.

UITextField: Text Entered Programmatically but not Visible in the Text Field

I have a weird behaviour that has only shown up in the last week. I don't use IB, all the controls are created in code.
I have a text field with a keyboard active. The first time I load the text field and use the keyboard, everything works normally. The second time I use it, the typed text does not show in the text field. However, the text is in the text field programmatically. For example, I can use it to execute a search. When the keyboard closes, the text appears.
Some of my UITextFields have misaligned text. For example, I write "hello", and instead of displaying centered inside the field like normal, it displays shifted several pixels downward to the extent that the bottom of the text is cut off. It's almost as if another view is chopping the bottom off the text by obscuring it.
I use three20, but according to http://groups.google.com/group/three20/browse_thread/thread/d7c4bc1ee2f9590d#, Xcode is suspected of causing the problem. I seen the behavior on 2 diferent macs, one running with Snow Leopard (10.6) and the other with Leopard (10.5).
This is how the problem looks in Xcode:
It is not obvious, but there is text in that search field. Notice that the placeholder text is not show. However, if I hit Search, the code executes with the entered text.
This is how the app appears in the simulator:
I finally find the reason.
I call [textField becomeFirstResponder] in a function called from loadView. But I move it to viewDidAppear and everything work Ok...
I've seen that happen with text fields and affine transforms. If you rotate a text field using a transform, the text shows up in a seemingly random part of the superview. If you use a transform to move the text field to make room for the keyboard, you might be seperating the embedded text editor from the field itself. That would also explain why the text is in the code because the text attribute of the text field is not affected by the visual layout of the UI.