我正在使用带有 UIbarButton 项目的工具栏,并且我为此提供了标签,在一种情况下,我需要获取工具栏的所有子视图并禁用一个按钮
for (id toolBarSubView in [self.topToolBar subviews]) {
NSLog(@"toolBarSubView details %@",toolBarSubView);
if ([toolBarSubView isKindOfClass:[UIBarButtonItem class]] && [toolBarSubView tag] == 103) {
UIButton* backButton = (UIButton*)toolBarSubView;
backButton.enabled = YES;
}
else if([toolBarSubView isKindOfClass:[UIBarButtonItem class]] && [toolBarSubView tag] == 102)
{
UIButton* navigationTitle = (UIButton*)toolBarSubView;
navigationTitle.enabled = NO;
}
else if([toolBarSubView isKindOfClass:[UIBarButtonItem class]] && [toolBarSubView tag] == 104)
{
UIButton* infoButton = (UIButton*)toolBarSubView;
infoButton.enabled = NO;
}
我正在使用上面的代码,我试图找到这样的类名 [toolBarSubView isKindOfClass:[UIBarButtonItem class]
但是条件失败了,没有一个条件是成功的,我必须在控制台中进行哪个类它是这样的 2013-09-13 12:15:35.943 Receipts[1544:60b] toolBarSubView details > 2013-09-13 12:15:35.945 Receipts[1544:60b] toolBarSub查看详情 > 2013-09-13 12:15:35.947 Receipts[1544:60b] toolBarSub查看详情 >