I want to have an Edit barButtonItem, when pressed I want to be able to select a segmented control and edit the segment title I select and save it. Is this possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Took me some time to come up with the example, but here it is!!!
Here is what is in my UIViewController header file:
Obviously my UISegmented control and its action item were connect in Interface Builder.
You must implement the action item for your segmented control here is mine
Implement the following 3 UITextFieldDelegate Methods as follows
This implements a key-by-key visible editing of a UISegmentedControl element.
NOTES:
This does not in any way implement the auto-resizing that may be necessary if the text is larger than the space provided by the control.
This also does not implement any form of visible cursor or visible selection code.
This will leave the textfield caret position after the last character in the string. It will copy the current UISegmentedControl’ text into the invisible textfield prior to editing so that you don’t lose your copy, although it could easily be edited to clear both prior to editing.