一,效果图。
二,代码。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self showFooter:YES];
}
-(void)showFooter:(BOOL)showFooter
{
NSLog(@"上拉刷新:加载更多view");
if(!loadMoreView)
{
loadMoreView=[[UIView alloc]init];
//加载控件
UIActivityIndicatorView *activeView=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[activeView setFrame:CGRectMake(110, 10, 30, 30)];
[activeView setBackgroundColor:[UIColor clearColor]];
[loadMoreView addSubview:activeView];
[activeView startAnimating];
//文本
UILabel *loadLabel=[[UILabel alloc]initWithFrame:CGRectMake(140, 10, 150, 30)];
[loadLabel setTextAlignment:NSTextAlignmentLeft];
[loadLabel setText:@"正在加载"];
[loadLabel setTextColor:[UIColor colorWithRed:150/255.00 green:150/255.00 blue:150/255.00 alpha:1.0]];
[loadLabel setBackgroundColor:[UIColor clearColor]];
[loadMoreView addSubview:loadLabel];
}
[loadMoreView setFrame:CGRectMake(0, 60, 320, 100)];
[loadMoreView setBackgroundColor:[UIColor clearColor]];
if(!loadMoreView.superview)
{
[self.view addSubview:loadMoreView];
}
if(showFooter)
{
[loadMoreView setAlpha:1];
}
else
{
[loadMoreView setAlpha:0];
}
}