UIView *leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 60, 60)]; UIButton *leftbtn =[UIButton buttonWithType:UIButtonTypeCustom]; leftbtn.frame = CGRectMake(-15, -5, 55, 55); [leftbtn setImage:[UIImage imageNamed:@"首页_u82"] forState:UIControlStateNormal]; [leftbtn addTarget:self action:@selector(toRootVCButton:) forControlEvents:UIControlEventTouchUpInside]; [leftView addSubview:leftbtn]; [self.view addSubview:leftView]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftView];
作者:afstand距离
链接:https://www.jianshu.com/p/695ed57cc0dc
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。