hi i'm designing a view, where i have to post a query to the bank. For that i take the following input .1)Contact Method : Phone, email or Post(1st Picker) .2) Contact time :Morning, Evening,Afternoon(2nd Picker) 3) Message
now when i select the first text field ie Contact Method, a picker view should display with its datasource. and when i select the contact time text field, it should display the datasource for contact time.
Please tell me how am i to do it
you can create 3 arrays for each variant. Then, create some pointer, for example, currentArray. use this array as dataSource. so the only you have to do - change current array and call [myPicker reloadAllComponents] when your new field becomes firstResponder.
Related
my project have A table view controller & B view controller.
A have name, company & phone number need fill in.
B just have job number need fill in.
I expect when I finished A then click next button then go to B page.
and B page had save button, it can save A & B user info (core data)
I expected "777777"(Job number) will show it at same table view cell
enter image description here
Thanks all!
What you should do:
Save info like name, etc on ViewController A in a dictionary.
Pass it to viewController B while pushing it over stack.
In B ViewController modify existing dictionary that you passed from A VC and append new key - job number in it.
Then simply save it using core data.
Check it out for core data.
In Swift.
I want to store this two values the 1.Name and 2.Address these are two text field which are in single row of table view cell and i have “+” button where i can add multiple entires.
so here what ever the values i have enter in the textfield it has to store locally.
And then the next time when i comes to screen i have to retrieve the data and load into the tableview.
So tried with creating the Array of dictionary with having the key value pair of name and address.
Storage Class:
class StorageModel: NSObject
var dict = [String: String]
*) Main Class:
With having the table view delegate and other stuff.
*) TableView Cell:
Which contains the
Name text field
Address text field.
So how can i implement this functionality. I was stuck on this. Please help me friends. Thanks in Advance.
On View1, I have an empty textView that will populate with data from a textField. The textField is on View2. Every time I swipe right to view the data in View1, it never lists in the textView. It overwrites whatever is currently there.
Here's my code: https://github.com/dward1289/Objective-CII/tree/master/week4Proj
The assignment is already done, but even after it was graded I never found out what I was doing wrong. Please take a look, and tell me what I can change so that the textField data will populate in the textView and not overwrite the current text.
I guess you want to append the new input to the old information
. If so,
-(void)DidClose:(NSString*)nameString
{
txtView.text = [txtView.text stringByAppendingString:nameString];
}
Here is my problem:
I have an array of model class(Let's say, 'addressModel' with fields address, street and city.). Now i have a custom cell with three UITextFields for the three fields in the model class. Once the user ends editin, i want to (validate &) add the data in the particular textfield to the respective model object. (Ex: user ended editing addressTextField, then addressModel.address = addressTextField.text).
How can we identify the textfield that the user selected and the indexPath.row? In my case i need to know both? Any help?
Thank you.
If your view controller implements the UITextFieldDelegate protocol, you can receive the textFieldDidEndEditing method call. In there, you can get the tag of the field that the user was just editing. When creating your cells you can specify some kind of integer tag scheme so that you can reverse engineer what section, row, and specific field the user was actually editing at the time. You could do something like:
textField.tag = (indexPath.section * 10000) + (indexPath.row * 100) + (textFieldIndex);
Assuming you don't have more than 100 textFields per row, or 100 rows per section, this particular scheme should work.
You can validate data when user finishes editing I mean you can validate data in UITextField delegate method:
- (void)textFieldDidEndEditing:(UITextField *)textField;
here no need to find out which textfield is edited since you will get that textfield.And if you want to identified which row then you can assign tag which is nothing but row, to textfield and on that basis you will come to know which row textfield is edited.
set the separate tag of each text field .. and on didEndEditing: method use the following code....
if(textField.teg == FIRST_TAG){
// do your code
}
else if(textField.teg == SECOND_TAG){
// do your code
}...
and soo on....
may this will help you...
Actually i used the pickerView for display My database value containing Name, SSN, Research Area etc. Now I need to search in each component of pickerview, like Name,SSN using SearchBar is it Possible?
If I understand you right, you want to filter the rows of the components when the searchtext changed.
You can have a NSArray for each component to populate it with: In – searchBar:textDidChange: you can check which entries in your arrays fit to the search text and add it to a array, that you will use to fill the picker. Don't forget to either call [aPickerView reloadAllComponents] or [aPickerView reloadComponent:i], this will tell the picker to draw itself again.