Button iOS中的分层(6)

Button iOS中的分层(6),button,ios6,uiimageview,layer,Button,Ios6,Uiimageview,Layer,在我的应用程序中,用户可以拖动一些图像,这些图像在他按下按钮时出现。问题是,当我将UIImageView拖到按钮上方并松开它时,我无法再触摸/拖动图像,因为按钮位于其上方,尽管图像在按钮上方 那么:我怎样才能把按钮放在背景上,把图像放在上面呢 这就是在触摸屏上创建UIImageView - (IBAction)SchiffRotButton:(id)sender { NSLog(@"setting schiffrot.png..."); [_SchiffRotImageV

在我的应用程序中,用户可以拖动一些图像,这些图像在他按下按钮时出现。问题是,当我将UIImageView拖到按钮上方并松开它时,我无法再触摸/拖动图像,因为按钮位于其上方,尽管图像在按钮上方

那么:我怎样才能把按钮放在背景上,把图像放在上面呢

这就是在触摸屏上创建UIImageView

- (IBAction)SchiffRotButton:(id)sender {  
    NSLog(@"setting schiffrot.png...");  
    [_SchiffRotImageView setImage:[UIImage imageNamed:@"schiffrot.png"]]; }  
这是按钮本身:

UIButton *SchiffRotBuztton = [UIButton buttonWithType:UIButtonTypeCustom];  
        SchiffRotBuztton.frame = CGRectMake(198, 646, 59, 59);  
        [UIImage imageNamed:@"schifffeldrot.png"];
通过此操作,我移动图像:

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
printf("touch moved \n");
UITouch *myTouch = [touches anyObject];
startPoint = [myTouch locationInView:self.view];
    if ([_whichPiece isEqualToString:@"SchiffGelbImageView"])
{
    _SchiffGelbImageView.center = CGPointMake(startPoint.x, startPoint.y);
}
谢谢你的帮助
LiGe

也许你问题中的一些代码会对你有更好的帮助。你能帮忙吗@数学