self.testView = [[UIView alloc] initWithFrame:CGRectMake(0, -30, 320,30)];
self.testView.backgroundColor = [UIColor yellowColor];
self.headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, 320, 21)];
self.headerLabel.textAlignment = NSTextAlignmentCenter;
self.headerLabel.text = @"text";
[self.view addSubview:self.testView];
[self.testView addSubview:self.headerLabel];
[UIView animateWithDuration:.5 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.testView.frame = CGRectMake(0, 0, 320,30);
} completion:^(BOOL finished) {
[UIView animateWithDuration:.5 delay:2.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.testView.frame = CGRectMake(0, -30, 320,30);
} completion:^(BOOL finished) {
}];
}];
转自:http://codex.wiki/question/1921614-3648/