小编use*_*374的帖子

UIButton作为子视图没有响应

我有一个UIButton内部的UIView内部UIImageView没有响应触摸.我无法弄清楚为什么.我已经将代码分解为最简单的形式,同时仍然执行我的原始程序.

#import "TestVideoViewController.h"

@interface TestVideoViewController ()

@property (strong, nonatomic)UIImageView *panel;
@property (strong, nonatomic)UIView *panelSC;
@property (strong, nonatomic)UIButton *panelButtonSC;
@property (strong, nonatomic)UIButton *videoButton;

@end

@implementation TestVideoViewController

-(void) viewDidLoad {

    _panelButtonSC  = [UIButton buttonWithType:UIButtonTypeCustom];
    [_panelButtonSC addTarget:self action:@selector(buttonPressedSC:) forControlEvents:UIControlEventTouchUpInside];
    [_panelButtonSC setTitle:@"Open" forState:UIControlStateNormal];
    _panelButtonSC.frame = CGRectMake(511, 701, 66, 67);

    _panel = [[UIImageView alloc] initWithFrame:CGRectMake(100, 768, 824, 600)];
    _panel.backgroundColor = [UIColor whiteColor];

    _panelSC = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 784, 560)];
    _panelSC.backgroundColor = [UIColor whiteColor];

    _videoButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_videoButton …
Run Code Online (Sandbox Code Playgroud)

objective-c uibutton uiview ios

2
推荐指数
1
解决办法
3046
查看次数

标签 统计

ios ×1

objective-c ×1

uibutton ×1

uiview ×1