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?
Related
I want to create a multi lined edit text that can hold buttons but also have the ability to add free form text.
It should behave like the tag text box of stackoverflow that is under the body of the question when you ask a question on stackoverflow.
I thought about one layout that holds buttons (e.g. tags) and an edit text right after said layout. But as I want it to be multi-lined and if there was a line break, I'm not sure how the edit text should behave, since it couldn't be a quadratic box anymore.
Can you point me in the right direction? I've seen a post about making parts of an edittext uneditable. I could do this and put buttons over it, but the buttons might be a little bigger than the underlying text.
Do you know of alternatives?
I hope you get the point, if not I'll draw the control.
You can achieve same by using FlowLayout. Keep on adding text/button view it will automatically wraps contents to next line
The UIKeyboardType.NumberPad looks like this:
What I want it to look like is this:
Is there a way to overlay a view in just that corner when the keyboard is up to add this single key? Is this possible with Swift 4?
The reason I want to do this is for easy ISBN number input for users, and some ISBN numbers (10 digits) have an X in them.
There is no way to modify the keyboard and any attempt to position a button in the correct spot will be a hack you want to avoid.
Probably the cleanest solution is to create a toolbar and set the toolbar as the text field's inputAccessoryView. On the toolbar, add a button for your X and maybe some other buttons such as a keyboard dismiss button, a Next button, or a Done button, etc.
I am creating a form in my iOS app in which certain text fields need to be hidden depending on the number that was entered in the previous field. For example if 1 is entered there will be one field, if 4 is entered there will be four fields etc. all the way up to 25. I understand how to hide the buttons depending on number...the problem is when I hide the buttons they still leave the white space because all the fields are set up to position at x and y height. I have tried to put the inputs into a table view because I thought it would allow me to hide each table view cell containing the input and then move the rest up. But XCode gives me an error saying I can't connect IBOutlet to repeating content. Positioning the x and y height in the code won't work either because I need to do this a few times and there would be too many variables.
I have looked for a solution everywhere and haven't been able to find a solution. Does any one know how to hide text fields and make everything else below move up?
You could use autolayout by anchor each textfield to the one above.
Or you could give a tag to each textfield and then iterate with a cycle for till the index of your previous view to setHidden:false to the textfields
I am displaying a text document using many UITextViews, one for each paragraph*. When the user drags the caret around it obviously stops when he reaches the beginning or end of a paragraph. Is there any way of letting the user drag the caret between text views as if all the text was in one text view? In a way that is allowed in the App Store?
* There is a good reason for this, at least if my proof-of-concept actually succeeds in proving the concept.
This would be a pain in the ass to implement, but going off this answer as an indicator of cursor-on-text:
how to get selected text from uitextfield in iphone?
Check the position of the cursor, and if it matches the length of text in a textfield, start a gesture listener, and if it moves down and right, change the focus to the next textview. Keep your textviews in an array for easy accessing.
As a new MonoToucher, I have a question which I'm struggling for a while now:
In some cases in my app I need to display a UITextView with a button to its right, at the bottom of the screen.
Basically, I would like to manage some kind of discussion feed in which when the user navigate to a specific discussion he gets the related posts as a list and have a multi-line text input at the bottom of the list with a 'Post' button to the right.
Touching that textView should show the keyboard for input, and the height of the textView should be related to the data entered.
This is the same behavior as we have when we want to write a new Text Message in iPhone, or a post in Facebook.
Another requirement is, that when the user scrolls the posts list, that input (with the button) should not move.
I tried creating a UIToolBar with UITextView and a UIButton, but I can't make it work as expected.
Check out the BubbleCell sample, it does exactly what you want in C#:
https://github.com/xamarin/monotouch-samples/tree/master/BubbleCell