UITableView底部FooterView实现上拉刷新
来源:互联网 发布:大富豪3.41棋牌源码 编辑:程序博客网 时间:2024/05/21 10:24
转载自:http://blog.sina.com.cn/s/blog_4d99ff710101030e.html
@interface FooterViewTestViewContro
// 表格数据数组,因为是演示代码,直接定义为数组
NSMutableArray *tableData;
NSMutableArray *tableMoreData;
NSUInteger dataNumber;
BOOL _loadingMore;
UITableView *table;
}
@property (nonatomic, retain) UITableView *table;
@property (nonatomic, retain) NSMutableArray *tableData;
@property (nonatomic, retain) NSMutableArray *tableMoreData;
// 创建表格底部
- (void) createTableFooter;
// 开始加载数据
- (void) loadDataBegin;
// 加载数据中
- (void) loadDataing;
// 加载数据完毕
- (void) loadDataEnd;
@end
@implementation FooterViewTestViewContro
@synthesize table;
@synthesize tableData;
@synthesize tableMoreData;
- (void)viewDidLoad {
table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 460) style:UITableViewStylePlain];
table.delegate = self;
table.dataSource = self;
[self.view addSubview:table];
tableData = [[NSMutableArray alloc] initWithObjects:
@"January",@"February",@"March",@"April",@"May",@"June",
@"July",@"August",@"September",@"October",@"November",@"December",nil];
tableMoreData = [[NSMutableArray alloc] initWithObjects:@"BAIDU",@"GOOGLE",@"FACEBOOK",@"YAHOO",nil];
[self createTableFooter];
}
#pragma mark -
#pragma mark Table view data source
// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableV
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
}
- (void)scrollViewDidEndDragging
{
if(!_loadingMore && scrollView.contentOffset.y > ((scrollView.contentSize.height - scrollView.frame.size.height)))
{
[self loadDataBegin];
}
}
// 开始加载数据
- (void) loadDataBegin
{
[self loadDataing];
}
// 加载数据中
- (void) loadDataing
{
dataNumber = [tableData count];
for (int x = 0; x < [tableMoreData count]; x++)
{
[tableData addObject:[tableMoreData objectAtIndex:x]];
}
[[self table] reloadData];
[self loadDataEnd];
}
// 加载数据完毕
- (void) loadDataEnd
{
_loadingMore = NO;
[self createTableFooter];
}
// 创建表格底部
- (void) createTableFooter
{
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
}
@end
- UITableView底部FooterView实现上拉刷新
- UITableView底部FooterView实现上拉刷新
- UITableView底部FooterView实现上拉刷新
- UITableView底部FooterView实现上拉刷新
- UITableView底部FooterView实现上拉刷新 (转自http://carlme.blog.163.com/blog/static/183716327201272421728204/)
- 上拉刷新中如何判断UITableView滚动到了底部
- UITableView上拉下拉刷新
- iOS UITableView 实现上拉及下拉刷新
- iOS UITableView 实现上拉及下拉刷新
- iOS UITableView 实现上拉及下拉刷新
- iOS-----iOS UITableView 实现上拉及下拉刷新
- UITableView之下拉刷新上拉加载
- UITableView 上拉刷新,下拉刷新
- RecyclerView简易底部上拉刷新
- RecyclerView,ExpandableListView添加底部上拉刷新
- UIScrollView UITableView 上拉刷新源码
- UITableView上拉与下拉刷新
- UItableView的上拉与下拉刷新
- 使用MinGW编译并配置wxWidgets
- Android中的Ajax
- Apple Push Notification Services in iOS 6 Tutorial: Part 1/2
- Android Intent调用大全、系统自带Intent调用大全
- play 框架的MVC结构
- UITableView底部FooterView实现上拉刷新
- 对文件压缩加密,解密解压缩,非对称加密,RSA,AES算法
- Android LayoutInflater 的使用
- WPF学习----数据绑定
- NSRunLoop 代码中暂停.
- Universal Image Loader for Android一些方法的参数
- 对象的串行化(Serialization)
- 如何去掉NSString中多个特殊字符
- LeetCode | Search Insert Position(查找插入位置)