在 UIBarButtonItem
中使用自定义图形时在 UIToolbar
内,程序会自动将图形变为白色并应用内阴影。如何防止这种自动样式设置并逐字使用我的自定义图形?
这是通常的做法:
UIImage *buttonImage = [UIImage imageNamed"myImage.png"];
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];
[myButton setImage:buttonImage forState:UIControlStateNormal];
[myButton setImage:buttonImage forState:UIControlStateHighlighted];
UIBarButtonItem *myBtnItem = [[UIBarButtonItem alloc] initWithCustomView:myButton];
[myButton addTarget:self actionselector(someSelector forControlEvents:UIControlEventTouchUpInside];
[myBtn setFrame:CGRectMake(someX, someY, someWidth, someHeight)];
[self.toolbar setItems:[NSArray arrayWithObjects:someBtnItemOne, myBtnItem, someBtnItemThree, nil]];
[myBtnItem release];
如果这没有帮助,能否请您显示用于初始化工具栏和按钮项的代码?
关于iphone - 如何从 UIBarButtonItem 中删除样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8199781/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |