在我的导航栏中,我有两个右键栏项目。一个是自定义按钮,另一个使用信息灯按钮类型。两者都工作得很好,但我想让自定义按钮具有默认发光,就像你触摸它时信息按钮一样。这可能吗?
// Default info light btn
UIButton *infoBtn = [UIButton buttonWithType:UIButtonTypeInfoLight];
UIBarButtonItem *infoBtnItem = [[UIBarButtonItem alloc]initWithCustomView:infoBtn];
// Custom Btn
UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom];
[customButton setFrame:CGRectMake(0, 0, btnImage.size.width, btnImage.size.height)];
[customButton setBackgroundImage:btnImage forState:UIControlStateNormal];
[customButton addTarget:self action:@selector(rightDrawerButtonPress:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *customButtonItem = [[UIBarButtonItem alloc] initWithCustomView:wlButton];
NSArray *rightBtns = @[customButtonItem, infoBtnItem];
[navItem setRightBarButtonItems:rightBtns animated:YES];