Iphone Custom UITabBarItem没有圆边 [英] Iphone Custom UITabBarItem without rounded edges

查看:105
本文介绍了Iphone Custom UITabBarItem没有圆边的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试自定义uitabbar

i try to customize a uitabbar

我扩展了uitabbar项目,现在有一个自定义图像,但我无法摆脱圆角。

i extended uitabbar item and now have a customized image in it but i cant get rid of the rounded edges.

代码:

@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知道如何获得摆脱图像周围的圆形矩形

maybe somoen knows how to get rid of the rounded rect

提前感谢
alex

thanks in advance alex

推荐答案

感谢用自定义标签栏项目解决了这个问题

thanks solved it with custom tab bar items

未经APPLE批准YET。

进入tabController1.m

goes into tabController1.m

    - (id) init
{   
    if(self = [super init])
    {
        CustomTabBarItem *tabItem = [[CustomTabBarItem alloc]
                                     initWithTitle:@"" image:nil tag:0];

        tabItem.customHighlightedImage=[UIImage imageNamed:TABBAR_TAB_4_ACTIVE];
        tabItem.customStdImage=[UIImage imageNamed:TABBAR_TAB_4_DEFAULT];       

        self.tabBarItem=tabItem;
        [tabItem release]; 
        tabItem=nil;    
    }
    return self;
}

cutom tabbaritem:

cutom tabbaritem:

@interface CustomTabBarItem : UITabBarItem  
{
    UIImage *customHighlightedImage;
    UIImage *customStdImage;
}

@property (nonatomic, retain) UIImage *customHighlightedImage;
@property (nonatomic, retain) UIImage *customStdImage;

@end

#import "CustomTabBarItem.h"


@implementation CustomTabBarItem

@synthesize customHighlightedImage;
@synthesize customStdImage;

- (void) dealloc
{
    [customHighlightedImage release]; customHighlightedImage=nil;
    [customStdImage release]; customStdImage=nil;   
    [super dealloc];
}

-(UIImage *) selectedImage
{
    return self.customHighlightedImage;
}

-(UIImage *) unselectedImage
{
    return self.customStdImage;
}

@end

这篇关于Iphone Custom UITabBarItem没有圆边的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆