美文网首页
仿新浪微博刷新显示多少条数据

仿新浪微博刷新显示多少条数据

作者: Desert_Eagle | 来源:发表于2017-10-06 11:23 被阅读0次
- (void)shownewStatusesCount:(int)count{
    UILabel *label = [[UILabel alloc] init];
    
    if (count) {
        label.text = [NSString stringWithFormat:@"共有%d条更新",count];
    } else {
        label.text = @"没有更新";
    }
    
    label.backgroundColor = [UIColor yellowColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor whiteColor];
    
    CGFloat labelH = 35;
    label.frame = CGRectMake(0, 64 - labelH, self.view.bounds.size.width, labelH);
    
    [self.navigationController.view addSubview:label];
    [self.navigationController.view insertSubview:label belowSubview:self.navigationController.navigationBar];
    
    CGFloat duration = 0.75;
    [UIView animateWithDuration:duration animations:^{
        label.transform = CGAffineTransformMakeTranslation(0, labelH);
    } completion:^(BOOL finished) {
        CGFloat delay = 1.0;
        
        [UIView animateWithDuration:duration delay:delay options:UIViewAnimationOptionCurveEaseInOut animations:^{
            label.transform = CGAffineTransformIdentity;
        } completion:^(BOOL finished) {
            [label removeFromSuperview];
        }];
    }];
}

相关文章

网友评论

      本文标题:仿新浪微博刷新显示多少条数据

      本文链接:https://www.haomeiwen.com/subject/ttvlyxtx.html