how to display previously selected value in UIPickerview selected bar - iphone

I am displaying numbers from 0 to 30 in a UIPickerview.
And call a pickerview when i tap on a button.
when ever i select one value in pickerview and tap on ok button to quit pickerview.
for the next time when ever i tap on button to open UIPickerview i need to display previous selected value like this.
for example previously i select 13 for the next time when i open pickerview i need to display 13 on selected bar as show in figure.
how can i done.
can any one please help me.
Thank u in advance.

Save user selection somewhere and before you show your picker view set its selection programmatically with selectRow:inComponent:animated: method:
// Create picker if needed
[pickerView selectRow:13 inComponent:0 animated:NO];
// Now show the picker

Related

CoreData Edit Row

Trying to implement core data edit record.
Current Status : In the view did Load I have aded
self.navigationItem.rightBarButtonItem = self.editButtonItem
The edit button is appeared on the top left navigation bar. By clicking the edit button the red busy icons are appearing. if I click the icon then delete button appears. When I click the table view cell then nothing happens.
Desired Response: I want to call the edit table view controller so that the record can be edited.
I have added didSelect but it is only being called when the table view is not in edit mode.
How to call the edit view controller if I tap any table view cell with the edit icon appearing on the left side.
For example in the clock app. When you click the edit button the red icons appeared on the left side. If we want to edit the time then we can tap the table view cell i.e. alarm time and a view is posed up to edit the time. Same functionality is required.
In order for the didSelectRowAtIndexPath to work during editing, you have to set the allowsSelectionDuringEditing to true

How do I show a UIPickerView when a button is pressed?

I am using a UIPickerView (Swift 3) to filter my list based on their category. But how to show the picker view on my Button. How the codes is?
when you click this button, you can add to superView or hidden by setting.

keeping iphone keyboard on screen and change its enter button name

i want to show my keyboard on screen , whenever a view is shown i.e my login screen..
and i also want to change the name of enter button to Login button.
please help
To change the return key value, change the UIReturnKeyType enum (UITextInputTraits).
If you want the keyboard to show on the screen when it loads, you need to hook up your UITextField to the delegate and include UITextFieldDelegate in your header file. (That is assuming you are using a UITextField.)
Then call:
[textField becomeFirstResponder]
in your viewWillAppear method to give focus to the UITextField which then raises the keyboard.

How to reset view each time its closed?

I have a table view that displays contact information. I have another view that acts as a "contact pad." Basically it has either empty or text filled rows. I want it to have empty rows (or default state) when the user taps on a button on the tableview and I want it to pre-populate text when the user taps a row on the tableview. My methods for writing/reading to the datasource work fine, but once the "contact pad" view is brought up; it saves its state.
For example, if I open the "contact pad" view with the button then it shows the proper default state. Then if I open the "contact pad" view via tapping on a row it will display the correct text, but if I go try to open it again via the button then it will not re-show the default state and instead will show the text from before.
How do I reset a view once it has been closed? Do I call dealloc() before [self removeFromSuperview]?
In the viewWillAppear method, just do a
[self.tableView reloadData];
This method will be called every time there is a navigation or each time the view is opened.
Just remember that after you add your view as a subview its retain count goes up by 1.
So if you remove it from the superview it comes down by 1. You should release your subview after you add it to another view. This way when you call removeFromSuperview it counts get down by one and gets freed totally.

how to remove the pickerview with out using ok or cancel button in iphone

Im new to iphone development. here in my application i added pickerview for some image categories. my problem is displaying pickerview but how to remove the pickerview when i click in view automaticaly it was dismiss.i added this code also [pickerview remove fromsuperview].
can any one plz help me about my problem for how to remove the pickerview programmaticaly in iphone.
thank you in advance.
use
- (void)dismissModalViewControllerAnimated:(BOOL)animated
in your picker's parent view controller