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

发布于 2024-11-06 19:08:26 字数 332 浏览 0 评论 0原文

Lovin' Sharekit

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

在尝试,但似乎找不到正确的组合...有人知道吗?

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

川水往事 2024-11-13 19:08:26

在 SHKConfig.h 中

修改

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

Add / 255.0 to your number(s)

这将我们的 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;
}

这为所有导航栏按钮(包括取消按钮)

着色 中提琴!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文