ウィンドウの下部からビューをロードするためにアニメーションを使用したかったのですが、これは presentmodalViewController を介して実行できることを知っていますが、ウィンドウの半分にビューをロードしたいだけなので、アプリの要件では有効ではありません。だから私はアニメーションを使用し、私がしたことを見てみましょう
-(void) displayPicker
{
UIButton *done = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[done setFrame:CGRectMake(197, 199, 103, 37)];
[done setBackgroundImage:[UIImage imageNamed:@"button_0.png"] forState:UIControlStateNormal];
[done setTitle:@"Done" forState:UIControlStateNormal];
[done setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[done addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside];
[pickerDisplayView addSubview:datePicker];
[pickerDisplayView addSubview:done];
//animating here
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
pickerDisplayView = [[UIView alloc]initWithFrame:CGRectMake(0, 185, 320, 275)];
[self.view addSubview:pickerDisplayView];
[UIView commitAnimations];
}
pickerDisplayView というビューには Picker と Button という 2 つのコンポーネントがありますが、問題は Picker が正しく動作しておらず、どちらのビュー (pickerDisplayView) もスムーズに読み込まれていないことです。
@マット:私はあなたの指示に従い、あなたがアドバイスしたように、私がしたことは次のとおりです
-(void) animationIn
{
CGPoint p = {x:0,y:185};
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
//pickerDisplayView = [[UIView alloc]initWithFrame:CGRectMake(0, 185, 320, 275)];
[pickerDisplayView setCenter:p];
[UIView commitAnimations];
}
しかし、問題は、ビューがウィンドウの上部にあり、正確な 185 の y 軸に達していないことです。これらの座標は IB から取得しました。助けてください先生