Sunday, 15 January 2012

ios - Textfield disappears behind keyboard when start editing -



ios - Textfield disappears behind keyboard when start editing -

i have textfield within scrollview. when tap textfield add together text, keyboard pops , textfield disappears behind keyboard. how solve this? scrollview should scroll downwards textfield still visible while typing.

i found several solutions objective-c project. unfortunately, using mono touch/c#.

i created delegate textfield. should add together method "public override void editingstarted (uitextfield textfield)" create work?

public class closetextfielddelegate : uitextfielddelegate{ private newreportscreen controller; public closetextfielddelegate(newreportscreen newreportscreen) { controller = newreportscreen; } public override bool shouldreturn (uitextfield textfield) { textfield.resignfirstresponder(); homecoming false; } public override void editingstarted (uitextfield textfield) { //do (make textfield visible doesn't disappears behind keyboard) } }

as example, how solved objc. here move view contains textfield visible (maybe can translate code mono/c#.

- (void)textfielddidbeginediting:(uitextfield *)textfield { if (textfield == mytf) { cgrect rect = inputfieldsview.frame; rect.origin.y = -100;//move view contains textfiled inputfieldsview.frame = rect; } }

ios monotouch

No comments:

Post a Comment