Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

ios - ScrollView with Tab bar

I have a to implement something similar to a chat.

So I thought I will add a scrollview then a table view then a view for textfield and send button then on top of it a tableview.

I also have a tabbar on bottom

Is this the right approach. I also wanted to bring the keyboard up and move the text box upwards

enter image description here

enter image description here

The images is not containing a scroll view because when ever i put a scroll view its screws me up

Additionally I also want to know how to increase the size of the rows depending on the chat message. just a crude drawing enter image description here

this is what I have achieved so far enter image description here enter image description here

I am not able to increase the size of the label according to the data, nor I am able to bring the textfield up when the keyboard is showing. :(

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

UITableView already inherits from, and contains a UIScrollView so you don't need to add a scroll view yourself, and it would probably cause problems, as I assume is the case from what you have described.

To have the cells adjust automatically, I would check out this tutorial https://www.captechconsulting.com/blogs/ios-8-tutorial-series-auto-sizing-table-cells. It provides lots of details on how and why it works.

For the message bar on the bottom, the way I've done it in the past, is to add the view with the text field and send button to a view (I'll call it the message view) the main view stuck to the bottom, then also set that message view as the input accessory on the text field, so when the text field starts editing, the view will be snapped to the top of the keyboard automatically. I can't quite tell how you have constrained the message view in your picture, but make sure that the bottom of the table view is not constrained to the top of the message view. You want the message view to be floating on top, then the table view can either be constrained the height of the message view from the bottom, or you can set the content inset to push content above the message view.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...