我已经选择了两个按钮,并且它们不断地从左向右移动,但是当我尝试单击其中一个时。即使我在动画上设置了 UIViewAnimationOptionAllowUserInteraction 属性,我也无法检测到单击了哪个按钮,但它对我不起作用。
{
m_pFacebookPostButton=[UIButton buttonWithType:UIButtonTypeCustom];
m_pFacebookPostButton.frame=CGRectMake(-320, 410, 320, 50);
[m_pFacebookPostButton retain];
[m_pFacebookPostButton setBackgroundColor:[UIColor greenColor]];
m_pFacebookPostButton.tag=204;
[m_pFacebookPostButton setTitle:@"Facebook" forState:UIControlStateNormal];
//[m_pFacebookPostButton addTarget:self action:@selector(clickone) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:m_pFacebookPostButton];
m_pFacebookPostButton1=[UIButton buttonWithType:UIButtonTypeCustom];
m_pFacebookPostButton1.frame=CGRectMake(0, 410, 320, 50);
[m_pFacebookPostButton1 retain];
[m_pFacebookPostButton1 setBackgroundColor:[UIColor redColor]];
m_pFacebookPostButton1.tag=205;
[m_pFacebookPostButton1 setTitle:@"Twitter" forState:UIControlStateNormal];
//[m_pFacebookPostButton1 addTarget:self action:@selector(clicktwo) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:m_pFacebookPostButton1];
[UIView animateWithDuration:5.0
delay:0.0
options:(UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionAllowUserInteraction)
animations:^{
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
m_pFacebookPostButton.frame = CGRectMake(0, 410, 320, 50);
m_pFacebookPostButton1.frame = CGRectMake(320, 410, 320, 50);
}
completion:^(BOOL finished){
NSLog(@"Move to left done");
}];
}
请帮我解决这个问题,谢谢提前帮助我。