Search code examples
buttoncustomizationsharekit

Sharekit customise modelview button colour


Lovin' Sharekit

Have custom backgrounds happening for the toolbars, but want to change the button colour in the modal view that displays which link to share (ie the Twitter link model view)...just can't find which file to add my customise nav bar button bar code to

Been trying but can't seem to find right combo... anyone know?

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

Solution

  • In SHKConfig.h

    Amend

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

    Add / 255.0 to your number(s)

    This pre-divides our RGB color into the floating point percentage for a UIColor

    In SHK.m

    Amend showViewController function

    // 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;
    }
    

    This tints all navigationBar buttons (including the Cancel button)

    Viola!