gpt4 book ai didi

ios - UIButton 响应框架外的事件

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:41:24 25 4
gpt4 key购买 nike

<分区>

我有一个导航 Controller ,我已将 UIButton 添加到导航栏,但它有问题。即使我点击按钮外的方式,它仍会称其为 Action 。

这就是我创建和添加按钮的方式:

UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[backBtn setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(backPressed:) forControlEvents:UIControlEventTouchUpInside];
[backBtn setFrame:CGRectMake(0, 0, 70, 30)];
//[backBtn setFrame:CGRectMake(20, 7, 70, 30)];

self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:backBtn] autorelease];

这是按钮的点击范围:

http://www.flickr.com/photos/98950925@N07/9465901718

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com