objective c - How can I hide/remove a subview by default when it's superview loaded but still have access to it? -


I have a view that displays a UIImage Weave and 2 UIButanens along with UILBL and UITFIFFULD sub-views . All of these form a form dedicated to date entry in a DD / MM / yyyy format.

I decided to make another scene (called datePickerView) inside my main scene, in which the UIDTicker example is present. When the date field is clicked on the above form, then this view is shown with a tax deduction.

I have methods that work with showing and hiding this scene:

  @property (weak, non-metic) IBOutlet UIView * datePickerView; - (Zero) Hide picture view {[UIView animated clutter: 0.5 Animation: ^ {[Self Date Picture View] Setframe: CGRactMake (0, 250, 320, 50)]; } Closing: ^ (BOOL End) {[Self Date Pictureview] removeFromSuperview]; }]; } - (zero) Show PickerView {[see it myself] addSubview: [auto date picker view]]; [[Self Date Picture View] Set Frame: CGRactMake (0, -250, 320, 50)]; [UIView ChetanVastvik: 1.0 Animation: ^ {[Self Date Picture View] Setframe: CGRactam (0, 152, 320, 260)]; }]; }  

I call these methods in my textFieldDidEndEditing and textFieldShouldBeginEditing UITextField rep methods.

My problem is seeing the scene with the date picture when it is full of supervised first time. I tried dragging this date picture view to the top of the hierarchy above all textfields and buttons but it only changes the scene behind them.

I have also tried to hide the view through the storyboard interface, try to add a hide and seek method, deedload, see the visual. The methods I tested were:

  [auto-date pictureview] removeFromSuperview]; [[Self Date Pictureview] Set Hareed: Yes]; [Self hide picture view];  

This does not hide the problem of DatePickerView, but when I click on the textfield, DatePickerView is not displayed.

Prefix textFieldShouldBeginEditing: (UITextField *) textField {// if the date field is missing since the error check (textField == [auto missingSafield]) {[auto show PickerView]; no return; } Yes return; } - (zero) textFieldDidEndEditing: (UITextField *) textField {if (textField == [auto missingSafid]) {[Self hidden picture view]; }}

When DatePickerView is not filled in any problem when I do not hide or remove datePickerView in size or form and tap it.

** Just after posting this question, I set a breakpoint in my showDatePicker method and when I delete [self datePickerView] removeFromSuperview]; I think my datePickerView outlet is zero, so it can be understood why I am having trouble. It is happening, by commenting again and trying again it shows that it is not zero.

I think this is wrong but not to make sure that to ensure that the deedload is running, my date pictureview is not zero. I can not display it under text fields in the background of the form and I do not think its color is turning to white so that the user can see that it is not elegant.

Support will be appreciated.

I have your IBOutlet property DatePickerView Code> weak , therefore, when you delete it from supervision, it is destroyed.

Either by making it strong , or use instead ( hidden property hidden to not showPickerView and yes in code> in hidePickerView - where you add and delete the view in the present).


Comments