I am working on a chat process where I need to place smileys and text together on the textbox, this part is done with no problems, the place where I am stuck is - if is want to place an image in between any text by dragging the cursor to a specified place, then how can this be done.
Right now I can place the image right after the text.
for eg: in my uitextbox -> [ Hi! how r u ? 'image' ]...
but if I want to do like this [ Hi! 'image' how r u ]....I should be able to select a position in textbox by dragging the cursor there and then select and place the image there..
Can anyone help me out on this?
Alright I figured out the solution for this... the above can be achieved using "UITextRange" and "UITextPosition" for the selected area in the UItextView. :)
Related
I want to create a View very similar To the iOS notes application. The main function is to allow the user to get a check box in front of a line of Text.
My first attempt is this:
I have a UITextView where i try to insert buttons on the left side of the View, the Problem is i dont get the right y Position for each line and the whole text is offsetted even if there is no Button in Front of the line.
Question:
Is there a better approach, maybe much simpler or even built in functionality in UITextView i couldnāt find?
If not, how do i get the exact y position of the line the cursor is currently in, so i can set the Buttons in the correct positions?
I need to write some text in openLayers 3... Not a label, something like a text object, that I can select and drag around the map. This text must have multiple lines.
I tried to use a point with ol.style.text, but it isn't multiline.
I also tried the popups, but I need the text to be always displayed.
Is there any way to use a text feature for this (ol.format.TextFeature)?
Is there any object that I can use for that purpose?
Thanks!!
You can use an ol.Overlay for that. An overlay is basically anything an Element can be. It has a position an positioning that can be set at any time.
See an example: http://openlayers.org/en/v3.9.0/examples/overlay.html?q=overlay
You could use map browser events (pointerdown, pointerup) and if the target is your overlay element then you could move it around and update its position.
Before I start I want to explain that I'm looking for a general solution to my inquiry, I don't have any code to show because I haven't the faintest idea of how to start. Let's say I have a program in which I have 4 buttons, two on the right (red and blue), two on the left (white and yellow). If I were to press a certain combination of buttons I want to get a specific output an example would be if I touch the red button and then the white one the word "cow" appears or if were to touch the white one then the red one the word "chicken" appears. Is there any documentation that anyone knows of that can help me with my problem? Can this even be done with an array?
HotLicks has a valid answer, but I think an NSDictionary is a better solution. Create keys based on button presses, like:
#{ #"RedWhite" : #"Cow",
#"WhiteRed" : #"Chicken" };
Your code will be easier to read, and you can support three presses easily (assuming you're working with a timer that you invalidate after each press) by just adding another key; no recalculating your array:
#{ #"RedWhiteBlue" : #"America" };
I have some textfield with text like "Click #button1, then #button2". Have you got any idea how to replace keywords by images ? I must do it in AS2 :/ I know there is htmlText in textField, but useing it I can only use one image, and image can only align left or right site.
Very advanced stuff. I can tell you there is no 'out of the box' solution like using html text fields or something similar. Especially if you want to mimic nearly html behaviour you have to code advanced routines that can : 1. recognize your keywords. You should google for tokenizers and 2. layout textfields according to occuring images and textblocks. Again, thats advanced!
I'm trying to figure out how the books draw a box perhaps with different background around a digression/example? Preferably how this would be accomplished in lyx, but latex solution would be welcomed as well :D
The color package should allow you to use the \colorbox command.
Examples (cited from this page, where you will find more details):
\colorbox{red}{Black text on red background}
\fcolorbox{blue}{red}%
{Black text, red background, blue frame}
If you need just a border and no background color, the built-in \fbox{text} command should do fine.
In Lyx you can do Insert -> Box. This creates a Box (Minipage) and you can put your content inside it. When you right click the Box (Minipage) and go to Settings, you can select type of the border or even drop shadow or shaded background via 'Decoration'. (This should be accessible directly through the right click menu as well.)
Hope this helps :)