Sharekit自定义模型视图按钮颜色

时间:2011-05-13 21:15:14

标签: button customization sharekit

Lovin'Sharekit

工具栏有自定义背景,但想要在模态视图中更改按钮颜色,以显示要共享的链接(即Twitter链接模型视图)...只是找不到要添加我自定义的文件导航栏按钮条形码

一直在尝试,但似乎找不到合适的组合......有谁知道?

- (void)viewDidLoad
{
    [super viewDidLoad];
    /*
     Colour the Nav Bar buttons
     */
    [self.navigationController.navigationBar applyCustomTintColor];
}

1 个答案:

答案 0 :(得分:1)

在SHKConfig.h

修改

#define SHKBarTintColorRed      219 /255.0 
#define SHKBarTintColorGreen    83 /255.0  
#define SHKBarTintColorBlue     106 /255.0 

将/ 255.0添加到您的号码

这将我们的RGB颜色预分为UIColor的浮点百分比

在SHK.m

修改showViewController函数

// Wrap the view in a nav controller if not already
if (![vc respondsToSelector:@selector(pushViewController:animated:)])
{
    UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease];

    if ([nav respondsToSelector:@selector(modalPresentationStyle)])
        nav.modalPresentationStyle = [SHK modalPresentationStyle];

    if ([nav respondsToSelector:@selector(modalTransitionStyle)])
        nav.modalTransitionStyle = [SHK modalTransitionStyle];

    nav.navigationBar.barStyle = nav.toolbar.barStyle = [SHK barStyle];

    // Added code
    UIColor* c = [UIColor colorWithRed:SHKBarTintColorRed green:SHKBarTintColorGreen blue:SHKBarTintColorBlue alpha:1.0];
    [(UINavigationController *)vc navigationBar].tintColor = c;
    // End added code

    [topViewController presentModalViewController:nav animated:YES];            
    self.currentView = nav;
}

// Show the nav controller
else
{       
    if ([vc respondsToSelector:@selector(modalPresentationStyle)])
        vc.modalPresentationStyle = [SHK modalPresentationStyle];

    if ([vc respondsToSelector:@selector(modalTransitionStyle)])
        vc.modalTransitionStyle = [SHK modalTransitionStyle];

    [topViewController presentModalViewController:vc animated:YES];
    [(UINavigationController *)vc navigationBar].barStyle = 
    [(UINavigationController *)vc toolbar].barStyle = [SHK barStyle];

    // Added code
    UIColor* c = [UIColor colorWithRed:SHKBarTintColorRed green:SHKBarTintColorGreen blue:SHKBarTintColorBlue alpha:1.0];
    [(UINavigationController *)vc navigationBar].tintColor = c;
    // End added code

    self.currentView = vc;
}

这会对所有navigationBar按钮(包括“取消”按钮)进行着色

中提琴!