【代碼筆記】正在載入,代碼筆記
一,。
二,代碼。
- (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]; } }