父试图和子试图不能全都打开用户交互

本文详细介绍了如何在iOS开发中自定义一个包含按钮和标签的UI组件,通过设置按钮图片和状态变化,以及为标签添加文本信息,实现了一个具有交互性的自定义视图。重点阐述了在不同状态下UI元素的配置和布局管理。

 UIView *footView=[[UIView alloc] initWithFrame:CGRectMake(0, 0,ScreenWidth , 90)];



        UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];

        [btn setImage:[UIImage imageNamed:@"8" ]forState:UIControlStateNormal];

        [btn setImage:[UIImage imageNamed:@"22" ]forState:UIControlStateHighlighted];

        btn.frame=CGRectMake(0, 35, ScreenWidth, 45);

        btn.userInteractionEnabled=YES;//

        

        [btn addTarget:self action:@selector(btnSearch) forControlEvents:UIControlEventTouchUpInside];

        [footView addSubview: btn];


        

        

        UILabel *lab=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 45)];

        lab.userInteractionEnabled = YES;//

        lab.textAlignment=NSTextAlignmentCenter;

        lab.textColor=white1;

        lab.text=@"201231日加入";

        lab.backgroundColor=[UIColor clearColor];

        lab.font=[UIFont systemFontOfSize:15.0f];

        [btn addSubview:lab];

        [lab release];

        _tableView.tableFooterView=footView;

        [footView release];

    




这里是脚标题,上面加上button     按钮上面再加上label文字信息。。。                   不能同时都打开用户交互   ,这样编译器识别不了时间


子试图  与  父试图  不能同时都打开用户交互。。。。  切记
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值