您的位置:首页 > 产品设计 > UI/UE

iOS 开发学习38 UIView嵌套UITableView

2015-06-24 16:17 579 查看
为了在UITableView里固定footer,在网上看到这样一段程序,但测试没起作用,这里仅作记录,以后理解了再回头来分析。

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

CGFloat sectionFooterHeight = 40;
CGFloat ButtomHeight = scrollView.contentSize.height - self.tableView.frame.size.height;

if (ButtomHeight-sectionFooterHeight <= scrollView.contentOffset.y && scrollView.contentSize.height > 0) {
scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
} else  {
scrollView.contentInset = UIEdgeInsetsMake(0, 0, -(sectionFooterHeight), 0);
}

}


目前测试可行的方法是外面嵌套UIViewController,UITableViewController我没有找到直接固定footer的方法。

#import <UIKit/UIKit.h>

@interface WasherFunsViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *table;

@end


#import "ViewController.h"

@interface WasherFunsViewController ()
@end

@implementation ViewController
@synthesize table=_table;

- (void)viewDidLoad
{
[super viewDidLoad];
_table.delegate=self;
_table.dataSource=self;

}
...其它代码省略...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: