【发布时间】:2011-11-13 08:41:55
【问题描述】:
以下是我用来通过-addSublayer向图层添加 UIButton 的代码:
CAGradientLayer * tile = [[tile alloc] init];
UIButton *XImageButton = [[UIButton alloc]init];
XImageButton.frame= CGRectMake(kXButtonlocX, kXButtonlocY, kXButtonHeight,kXButtonWidth );
[XImageButton setTitle:@"xbutton" forState:UIControlStateNormal];
[XImageButton addTarget:nil action:@selector(XbuttonTouchEvent)
forControlEvents:UIControlEventTouchUpInside];
[tile addSublayer:XImageButton.layer];
XImageButton 没有响应触摸事件。我该如何解决这个问题,以便它做出响应?
【问题讨论】:
标签: ios cocoa-touch uibutton core-animation