Good afternoon. I would like to know if there is a method that makes the text-field capable of "remember" what the user wrote the previous times, so when the user writes the first letter a list with the proposed words will appear!! :) Thanks!
It can possible to show the list of values in tableview. you can use autocomplete.
Read this article. and also with source code. This will help you.
Sample image
Not that easy, you will have to do some modifications, for example you will need to store in an NSMutalbeArray all the value inserted, then you will have to present a table when the user starts to edit the UITextField this will change as the user writes
as your app runs, there will be many text that you need to remember/store that it will come to the point that your text that you have to remember will grow to size. you can store your text to a local database (sqlite), then as the user writes on the text field, do a search query and return the data.
unless you dont want to remember the text entered when the user used and exited/quit your app.
Related
I'm in the process of writing an app with which you can take a picture of a text and then the text is scanned and transferred to a variable. I've done that with the plugin firebase_ml_vision and everything works.
The problem I have is that I want to decide for myself which text is scanned from the photo. For example, this could work in such a way that each word and number is automatically given a frame and the user then taps the words that are transferred to the variable. This also works with Google translator (see screenshot) but unfortunately I haven't found anything yet how to do it... Do you know how it works?
The firebase-mlkit's text recognition API returns a frame as well as cornerPoints for each of the VisionTextBlock, VisionTextLine, and VisionTextElement:
https://firebase.google.com/docs/reference/swift/firebasemlvision/api/reference/Classes/VisionTextBlock
They should help you to select the words, lines, or text blocks.
so I have a UITableView and within each cell, a UITextView. I want the user to be able to edit each UITextView as many times as they like, then go back to somewhere else in the app, close the app, whatever, and then come back and see the same thing they wrote. I have not been able to figure out how to do it.
Please help. I'm still pretty new to Swift.
This is a design problem. Anyway my suggestion is to add a flag in your data model.
Data model (the data that you are presenting in your table). If you don't have any data model, add one.
Example:
class UserInformation {
name: String
isEditing: Bool = false
}
and then save this in your preferred location either in DB (core data, realm etc) or plist (which i don't recommend)
now during the creation of cell. You could just check if this is in editing mode. And then fill up the text field using the saved data.
EDIT: You can't just magically know/retain a state in an object without persisting.
You want to store textView informations in any case, including terminating application, there are some steps to implement this feature.
At first, you have to pick up a place for storing your information:
Hard disk
Your own server
Other service (firebase ...)
RAM is not useable in this case.
Supposing you like hard disk option, let's select a method for storing:
Create a file (JSON, text file, ...), save your information every time user enter a new one, open it to get information back.
Save it by CoreData / Realm in database way (CoreData is like SQL lite, a lite weight database for mobile application supported by Apple)
I want to create custom reminder without using alarm, because I have requirement like when a uitextfield 's value increases than previous value the reminder need to be called.
So Is there any way for doing that ???
Thanks in advance
If you want to show an alert if the text entered in the textfield is greater than 1000 in length, then use
1.
UITextField delegate methods. There are methods that get called at every time you enter any character in the textfield. Read more here. You will find a method of your needs.
2.In that method use an if-else condition to check the length of the enteterd text.
Find a property in this link which helps you getting to the length of the text entetered so far in textfield.
3.Use UIAlertView to show alert. Here is the link.
PS: I could have given you the code, but I think it would be more beneficial for you to read these docs and try to implement. In case you stuck somewhere, ask specific questions and we will help you.
I think you have to be more specific, but as far as I get what you need is, if the value increase then previous values. For this you need to store last entered text onto string and if user type new text then compare it and if it is increase then set or show alert view.
Add your logic into this delegate.
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
Thanks. Hope it'll help.
I have created one Login Screen where user enter their mail id.
But i want to insert one functionality where it should list the mail id automatically when user type first character of mail id
There is one way. I don't know how much feasible it is. So the Idea is : You can store somewhere all the email id after log in success. For example in sqlite database. Now, Implement Notification center for "UITextFieldTextDidChangeNotification" and search for the character in database when user start typing in TextField and show UITableview underneath UITextField with match results (which start from entered character).
When user tap on any cell of Tablview hide tableview and take that cell label value in UITextField. That's it. Hope this logic work.
You can save the emaid id in UserDefaults & use it whereever you want
My problem is twofold: 1) I'm trying to determine an eloquent way to allow the user to type into a UITextView and store the time each word was typed into an array. The time will be a float which starts at 0 when the user begins to type. 2) Conversely, I'd like the user to be able to tap on a word in the UITextView and display the time that word was typed (displaying in an NSLog() is fine). Considerations that may throw a wrench into a possible approach -- what if the user goes back to the top of the text and starts typing or to the middle of the text?
Even a suggested approach without code would be appreciated, because right now I'm drawing a blank.
I think you will need to have a delegate for UITextView which implements textView:shouldChangeTextInRange:replacementText:. In there you get every character that the user types. You can get the time/date (using NSDate) and save it when the user starts a word.