ios - Moving view when UITextField Keyboard gets activated -


this question has answer here:

the following problem occurs when activate uitextfield (better if show couple images try touiviewwhich nested within myuitableviewcontroller` footer.

yikes can delete question. jeez

as understand question, trying shift entire view when uitextfield becomes first responder (i.e. adds keyboard view)? if case, add code in uitextfield delegate method:

#define view_tag 12345 #define kkeyboardoffsety 80.0f  - (void)textfielddidbeginediting:(uitextfield *)textfield {     // reference view want move when editing begins     // can done setting tag of container view view_tag     uiview *containerview = (uiview *)[self.view viewwithtag:view_tag];     [uiview animatewithduration:0.3 animations:^{         containerview.frame = cgrectmake(0.0f, -kkeyboardoffsety, containerview.frame.size.width, containerview.frame.size.height);     }]; }  - (void)textfielddidendediting:(uitextfield *)textfield {     uiview *containerview = (uiview *)[self.view viewwithtag:view_tag];     [uiview animatewithduration:0.3 animations:^{         containerview.frame = cgrectmake(0.0f, self.view.frame.origin.y, containerview.frame.size.width, containerview.frame.size.height);     }]; } 

you don't have use 'viewwithtag' method, need reference container view, can done iterating through subviews.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -