- (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];
}];
}];
}
网友评论