そんなときに使えるのがこのメソッド
- (void)viewDidLoad { [super viewDidLoad]; CGRect frame = self.view.bounds; UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, frame.size.height - 100, frame.size.width, 100)]; label.backgroundColor = [UIColor colorWithWhite:1 alpha:0.8]; [self.view addSubview:label]; [UIView animateWithDuration:0.5 animations:^{ label.frame = CGRectMake(0, frame.size.height - 100, frame.size.width, 100); }]; }このコードを動かすと、画面が表示されてから0.5秒掛けながら、画面の下から100px分表示されていた透明なバーが下に下がっていく。
おためしあれ〜〜
No comments:
Post a Comment