UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
leftBtn.frame = CGRectMake(0, 0, 30, 30);
[leftBtn setImage:[UIImage imageNamed:@"jiahao"] forState:UIControlStateNormal];
[leftBtn addTarget:self action:@selector(CreatTalking) forControlEvents:UIControlEventTouchUpInside];
UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0,0, 20, 20)];
[customView addSubview:leftBtn];
customView.userInteractionEnabled = NO;
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:customView];
改变导航栏左边按钮的点击区域
最新推荐文章于 2022-08-10 17:48:46 发布