一,效果图。
images/loading.gif' data-original="http://images2015.cnblogs.com/blog/337518/201510/337518-20151022104426724-1572110566.jpg" width="218" height="400" />
二,代码。
- (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]; } }
原标题:【代码笔记】正在加载
关键词: