显示微博刷新数

2018-02-03  本文已影响9人  白雪天枫

//显示微博刷新数

-(void)showStatusCount:(int)count {

    UILabel *label = [[UILabel alloc]init];

    label.backgroundColor = [UIColor grayColor];

    label.textAlignment = NSTextAlignmentCenter;

    label.textColor = [UIColor whiteColor];

    label.font = [UIFont systemFontOfSize:16];

    label.width = [UIScreen mainScreen].bounds.size.width;

    label.height = 35;

    label.y = 64 - label.height;

    if (count) {

        label.text = [NSString stringWithFormat:@"有%d条微博更新了",count];

    }else{

        label.text = @"没有新的微博";

    }

    [self.view addSubview:label];

    //添加label

    //    [self.navigationController.view insertSubview:label belowSubview:self.navigationController.navigationBar];

    //出来的动画

    [UIView animateWithDuration:0.5 animations:^{

        label.transform = CGAffineTransformMakeTranslation(0, label.height);

    } completion:^(BOOL finished) {

        [UIView animateWithDuration:0.5 delay:0.5 options:UIViewAnimationOptionCurveLinear animations:^{

            label.transform = CGAffineTransformIdentity;

        } completion:^(BOOL finished) {

            [label removeFromSuperview];

        }];

    }];

}

上一篇 下一篇

猜你喜欢

热点阅读