Iphone 自定义 UITabBarItem 没有圆角边缘
我尝试自定义 uitabbar,
我扩展了 uitabbar 项目,现在其中有一个自定义图像,但我无法摆脱圆角边缘。
代码:
@interface CustomTabBarItem : UITabBarItem
{
UIImage *customHighlightedImage;
}
@property (nonatomic, retain) UIImage *customHighlightedImage;
@end
@implementation CustomTabBarItem
@synthesize customHighlightedImage;
- (void) dealloc
{
[customHighlightedImage release]; customHighlightedImage=nil;
[super dealloc];
}
-(UIImage *) selectedImage
{
return self.customHighlightedImage;
}
@end
也许 somoen 知道如何去除
图像周围的
圆角矩形,提前致谢 亚历克斯
i try to customize a uitabbar
i extended uitabbar item and now have a customized image in it but i cant get rid of the rounded edges.
code:
@interface CustomTabBarItem : UITabBarItem
{
UIImage *customHighlightedImage;
}
@property (nonatomic, retain) UIImage *customHighlightedImage;
@end
@implementation CustomTabBarItem
@synthesize customHighlightedImage;
- (void) dealloc
{
[customHighlightedImage release]; customHighlightedImage=nil;
[super dealloc];
}
-(UIImage *) selectedImage
{
return self.customHighlightedImage;
}
@end
maybe somoen knows how to get rid of the rounded rect
around the image
thanks in advance
alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这很脏 - 但有效并获得批准:
标签控制器设置中
在 tabviewcontroller1 init 方法的
并且自定义标签栏看起来像
重要:< /strong>
我对 iphone 开发还很陌生,并且非常确定你可以用这种方式来减少黑客行为。此外,我获得了批准,但这并不意味着您也会自动获得批准。
This is dirty - but works and got approved:
in the tab controller setup
in the tabviewcontroller1 init method
and the custom tab bar it looks like
IMPORTANT:
i'm pretty new to iphone development and pretty pretty shure you can do this way less hacky. furthermore i got approved with this which does NOT mean you autmoatically will, too.
感谢使用自定义选项卡栏项目解决了这个
问题尚未获得苹果批准。
进入tabController1.m
cutom tabbaritem:
thanks solved it with custom tab bar items
NOT APPLE APPROVED YET.
goes into tabController1.m
cutom tabbaritem:
将具有圆角的视图上的
cornerRadius
设置为 0:此外,您可能需要添加 #include 来获取 CALayer 声明:
Set the
cornerRadius
on the view that has rounded corners to 0:Also, you will probably need to add a #include to get the CALayer declarations:
我对上面的实现有一个疑问。
按照苹果的规定,我们不应该使用私有/未记录的 API,
在上面的代码中,
这两个方法没有在自定义子类 CustomTabBarItem 中定义。
这些方法是 UITabBarItem 类中未记录/隐藏的方法,并在 CustomTabBarItem 类中重写。
重写未记录的方法可以吗?
我仍然很惊讶这怎么能得到苹果的批准。
我需要在这里澄清一些。
I have a query in the above implementation.
As per apple we should not use private / un-documented API's,
In the above code, the two methods
These methods were not defined in the custom subclass CustomTabBarItem.
These methods are un-documented / hidden methods in UITabBarItem class and overridden in the CustomTabBarItem class.
Is it fine to over-ride the undocumented methods?
I am still surprised how this got approved by Apple.
I need some clarifications here.
Apple 使用此代码验证了其他任何应用程序吗?很想知道我们是否有权使用 selectedImage 和 unselectedImage 方法?
Any other apps validated by Apple with this code ? Very interested to know if we are authorized to use selectedImage and unselectedImage methods ?