我已经在界面构建器中构建了我的GUI,使用at工具栏+栏项目。现在,我需要在代码中引用按钮(UIBarItems),并尝试使用viewWithTag方法(因为我已经在IB中给出了条形图项目的标签号)。
下面是我的代码,但它总是返回null!
UIBarItem *backButton = (UIBarItem *)[self.toolbar viewWithTag:1];
NSLog(@"backButton: %@", backButton); // returns nil发布于 2011-02-03 03:58:10
您应该在“items”属性中查找项目,而不是在子视图中。
https://stackoverflow.com/questions/4879165
复制相似问题