ios - TextField not showing on a view that has table on top and textfield at bottom -
i have view table on top , textfield @ bottom. kind of chat. envision when user types in textfield
, presses send button (not shown in screenshot) table update entry.
question
my problem when click textfield
, keyboard shows textfield
isn't visible. shown in screen shot below.
this how i'm making 2 views:
@my_table = rmq(self.view).append(uitableview, :top_style).get @bottom = rmq(self.view).append(uiview, :bottom_style).get @bottom = rmq(:bottom_style) @send = @bottom.append(uitextfield, :send).get
stylesheet
def top_style(st) st.frame = {t: 0, l: 0, w: screen_width, h: screen_height - 100} st.background_color = color.white end def bottom_style(st) st.frame = {t: screen_height-100, l: 0, w: screen_width, h: screen_height} st.background_color = color.battleship_gray end def send(st) st.frame = {l: 3, t: 5, w: 220, h: 30} st.background_color = color.white st.view.font = font.small st.layer.cornerradius = 5 st.view.placeholder = "say something..." end
update
output rmq log
─── uiview 282653120 {l: 0, t: 64, w: 320, h: 504} ├─── uitableview ( top_style ) 264785408 {l: 0, t: 0, w: 320, h: 468} │ ├─── uitableviewwrapperview 282624240 {l: 0, t: 0, w: 320, h: 468} │ │ ├─── notescell ( note_cell ) 282682640 {l: 0, t: 60, w: 320, h: 30} │ │ │ ├─── uitableviewcellscrollv 282585904 {l: 0, t: 0, w: 320, h: 30} │ │ │ │ ├─── uitableviewcellcontent 282688128 {l: 0, t: 0, w: 320, h: 30} │ │ │ │ │ ├─── uilabel ( cell_label ) 282583168 {l: 15, t: 0, w: 290, h: 30} │ │ ├─── notescell ( note_cell ) 282696944 {l: 0, t: 30, w: 320, h: 30} │ │ │ ├─── uitableviewcellscrollv 282690432 {l: 0, t: 0, w: 320, h: 30} │ │ │ │ ├─── uitableviewcellcontent 282617184 {l: 0, t: 0, w: 320, h: 30} │ │ │ │ │ ├─── uilabel ( cell_label ) 282578944 {l: 15, t: 0, w: 290, h: 30} │ │ ├─── notescell ( note_cell ) 282671168 {l: 0, t: 0, w: 320, h: 30} │ │ │ ├─── uitableviewcellscrollv 282723568 {l: 0, t: 0, w: 320, h: 30} │ │ │ │ ├─── uitableviewcellcontent 282709936 {l: 0, t: 0, w: 320, h: 30} │ │ │ │ │ ├─── uilabel ( cell_label ) 282653440 {l: 15, t: 0, w: 290, h: 30} │ ├─── uiimageview 282715328 {l: 316.5, t: 461, w: 3.5, h: 7} │ ├─── uiimageview 282714752 {l: 313, t: 464.5, w: 7, h: 3.5} ├─── uiview ( bottom_style ) 282440352 {l: 0, t: 468, w: 320, h: 568} │ ├─── uitextfield ( send ) 282618928 {l: 3, t: 5, w: 220, h: 30} │ │ ├─── uitextfieldlabel 282587568 {l: 0, t: 0, w: 220, h: 29}
where creating views? inside custom uitableviewcell
? if so, in layoutsubviews
method, make sure not call super
, system titleview , subtlte view won't created.
see here example: https://github.com/mohawkapps/aloft/blob/master/app/views/wind_cell.rb#l18
edit... didn't quite understand question previously.
looks you're going have manually reposition bottom view when keyboard shown , hidden. try this:
def create_stuff @my_table = rmq(self.view).append(uitableview, :top_style).get @bottom = rmq(self.view).append(uiview, :bottom_style).get @bottom = rmq(:bottom_style) @send = @bottom.append(uitextfield, :send).get @send.get.delegate = self # crucial rest work end def textfielddidbeginediting(textfield) rmq(@bottom).animate( duration: 0.3, animations: lambda{|q| q.move top: keyboard_height # animate somewhere } ) end def textfielddidendediting(textfield) rmq(@bottom).animate( duration: 0.3, animations: lambda{|q| q.move top: -keyboard_height # animate somewhere } ) end
something along lines should work.
Comments
Post a Comment