我想使用更好的风格的UIBarButtonType作为典型的UIButton。这只是用于视图而不是导航栏。UIBarButtonType作为UIButton。不在NavigationBar上!
我真的不想重新创建图像应用程序中的按钮,并适用于各种状态。我知道如何做到这一点,所以一定有办法。
请帮忙。
我想使用更好的风格的UIBarButtonType作为典型的UIButton。这只是用于视图而不是导航栏。UIBarButtonType作为UIButton。不在NavigationBar上!
我真的不想重新创建图像应用程序中的按钮,并适用于各种状态。我知道如何做到这一点,所以一定有办法。
请帮忙。
我想这和它的作品:
UIButton *info = [UIButton buttonWithType:UIButtonTypeInfoLight];
UIBarButtonItem *infoBis = [[UIBarButtonItem alloc] initWithCustomView:info];
NSArray *array = [[NSArray alloc] initWithObjects:infoBis, nil];
[tool setItems:array animated:YES]; //tool = UIToolbar
不要忘记把目标对你的UIBarButtonItem;)
你不能那样做。 UIBarButtonItems仅用于UIToolbar和UINavigationBar。 您需要创建自己的背景图像。这不是一个大问题,只有几行。
MacTeo,感谢队友。我最终创建了UIToolBar的子类并绘制了透明像素: 'code'-(void)drawRect:(CGRect)rect UIImage * image = [UIImage imageNamed:@“transparent.png”]; \t [image drawInRect:rect]; \t [image release]; } 'code' 然后将我想要的UIBarButtonItem添加到该子类ToolBar的实例中。然后把它放在我需要的地方。工作很好。但我结束了与UI设计不同的路线,所以没有人会看到实现。 – elliotrock 2011-02-28 04:43:46