简体   繁体   English

滚动UITableView显示表格的底部被切除

[英]Scrolling on UITableView shows bottom part of table cut off

I have a TableView in a View, and when it scrolls, the rounded part of the table at the bottom is cut off. 我在View中有一个TableView,当它滚动时,表格底部的圆形部分被切除。 I'd like it to behave like the Stocks app, where the table view is fixed with round corners and scrolling scrolls within the fixed rounded corners. 我希望它的行为类似于Stocks应用程序,在该应用程序中,表格视图固定有圆角,并在固定的圆角内滚动滚动。 How is that done? 怎么做?

在此处输入图片说明

First, add the QuartzCore framework library to your project if you haven't. 首先,如果尚未将QuartzCore框架库添加到您的项目中。

Then, in your UIViewController that manages the UITableView, do: 然后,在管理UITableView的UIViewController中,执行以下操作:

#import <QuartzCore/QuartzCore.h>

And then on viewDidLoad: 然后在viewDidLoad上:

myTableView.layer.cornerRadius = 8;

And that will give it 8px rounded corners. 这将使它具有8px的圆角。 The QuartzCore framework exposes a lot of very useful things that you can do with UIViews and their internal layers. QuartzCore框架提供了许多非常有用的功能,您可以使用UIView及其内部层进行操作。 Experiment away! 试试吧!

For your This Requirement i just tell you use ScrollView Help ... In ScrollView Just Put tableview and in viewWillAppear or where your data reload at that time put bellow code 对于您的此要求,我只是告诉您使用ScrollView帮助...在ScrollView中,只需将tableview和viewWillAppear放进去,或者将您的数据重新加载到以下位置

     yourTableView.frame = CGRectMake(yourTableView.frame.origin.x,yourTableView.frame.origin.y, yourTableView.frame.size.width, yourTableView.contentSize.height);

    float ftbl = yourTableView.frame.origin.y + yourTableView.contentSize.height + 15;
    yourScrollView.contentSize=CGSizeMake(320, ftbl);

Here declare tableview type with Grouped if required.. Sure this useful to you ... :) 如果需要,在这里用Tableed声明tableview类型。确保对您有用... :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM