このフォーラムで「アニメーションが機能しない場合のUIView内のUIButton」というトピックに対する回答を提供する多くの質問を見てきましたが、次のような回答を試した後
a) UIViewAnimationOptionAllowUserInteraction to the options
b) subView.setUserInteractionEnabled = YES
c) [button addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside];
それらのどれも私のために働いていません:-(
これがシナリオです。アプリはランドスケープモードであり、menuViewと呼ばれるUIViewはx = 480、y=0に配置されます。その高さ=200および幅=150。だから、右上のボタンをタップすると、次のコードが実行されます
- (IBAction)showMenu {
[menuView setUserInteractionEnabled:YES];
[optionsButton setUserInteractionEnabled:YES];
[UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.view.frame = CGRectOffset(self.view.frame, 0, 200);
}
completion:NULL];
}
出力?:ビューは表示されていますが、menuView内のoptionsButtonはクリックできません。イベントに接続し、NSLog(@ "オプションボタンがクリックされました")を実行しましたが、何も起こりません:-(
私が間違っていることを教えてください。
更新:「menuView」であるサブビューをself.view内に配置し、実行してoptionsButtonをクリックすると、NSLogメッセージが表示されます。menuViewのorigin.xを480以上に指定した場合のみ、機能しません。