如何更改 TTNavigator(对于网页网址)底部栏颜色?

发布于 2024-12-06 05:25:59 字数 1393 浏览 0 评论 0原文

这是我通过 TTNavigator 打开网站的代码 -

- (IBAction)btnTemp_Click{

    TTNavigator* navigator = [TTNavigator navigator];
    navigator.supportsShakeToReload = YES;
    navigator.persistenceMode = TTNavigatorPersistenceModeAll;

    [navigator openURLAction:[[TTURLAction actionWithURLPath:@"http://www.google.com"] applyAnimated:YES]];
}

在这里我能够管理其导航栏项目、颜色等 -

- (void)addSubcontroller:(UIViewController *)controller animated:(BOOL)animated transition:(UIViewAnimationTransition)transition 
{
    [self.navigationController addSubcontroller:controller animated:animated transition:transition];

    UIButton *btnBack =  [UIButton buttonWithType:UIButtonTypeCustom];
    [btnBack setImage:[UIImage imageNamed:@"navback.png"] forState:UIControlStateNormal];
    [btnBack addTarget:self action:@selector(popThisView) forControlEvents:UIControlEventTouchUpInside];
    [btnBack setFrame:CGRectMake(0, 0, 32, 32)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnBack];

    UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnBack];
    [controller.navigationItem setLeftBarButtonItem:backBarButtonItem animated:YES];

    [btnBack release];
    TT_RELEASE_SAFELY(backBarButtonItem);
}

但我无法更改具有后退、前进、停止和刷新按钮的底部栏的颜色。

请任何人帮忙。必须这样做,因为我在许多应用程序中看到它以不同的颜色显示。

Here is a code i made to open a website via TTNavigator-

- (IBAction)btnTemp_Click{

    TTNavigator* navigator = [TTNavigator navigator];
    navigator.supportsShakeToReload = YES;
    navigator.persistenceMode = TTNavigatorPersistenceModeAll;

    [navigator openURLAction:[[TTURLAction actionWithURLPath:@"http://www.google.com"] applyAnimated:YES]];
}

and here i was able to manage its navigation bar items, color etc-

- (void)addSubcontroller:(UIViewController *)controller animated:(BOOL)animated transition:(UIViewAnimationTransition)transition 
{
    [self.navigationController addSubcontroller:controller animated:animated transition:transition];

    UIButton *btnBack =  [UIButton buttonWithType:UIButtonTypeCustom];
    [btnBack setImage:[UIImage imageNamed:@"navback.png"] forState:UIControlStateNormal];
    [btnBack addTarget:self action:@selector(popThisView) forControlEvents:UIControlEventTouchUpInside];
    [btnBack setFrame:CGRectMake(0, 0, 32, 32)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnBack];

    UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnBack];
    [controller.navigationItem setLeftBarButtonItem:backBarButtonItem animated:YES];

    [btnBack release];
    TT_RELEASE_SAFELY(backBarButtonItem);
}

but i am not able to change color of bottom bar that has back, fwd, stop and refresh bottons.

Anybody please help. It must be done because i saw this in different colors on many applications.

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

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

发布评论

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

评论(2

寂寞美少年 2024-12-13 05:25:59

更改工具栏的颜色和样式应使用 TTStyleSheet 类来完成。

首先,您应该将 TTDefaultStyleSheet 扩展到您自己的类,并包含这些函数来更改 UINavigationBar 和较低的 UIToolbar 的颜色:

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark TTDefaultStyleSheet


///////////////////////////////////////////////////////////////////////////////////////////////////
- (UIColor*)navigationBarTintColor {
  return RGBCOLOR(0, 60, 30);
}


///////////////////////////////////////////////////////////////////////////////////////////////////
- (UIColor*)toolbarTintColor {
  return RGBCOLOR(0, 60, 30);
}

然后您应该加载样式表类进入您的应用程序委托:

[[[TTStyleSheet setGlobalStyleSheet:[[[StyleSheet alloc] init] autorelease]];

changing the colors and style of the toolbars should be done using a TTStyleSheet class.

First, you should extend the TTDefaultStyleSheet to your own class and include these functions to change the colors for both the UINavigationBar and the lower UIToolbar:

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark TTDefaultStyleSheet


///////////////////////////////////////////////////////////////////////////////////////////////////
- (UIColor*)navigationBarTintColor {
  return RGBCOLOR(0, 60, 30);
}


///////////////////////////////////////////////////////////////////////////////////////////////////
- (UIColor*)toolbarTintColor {
  return RGBCOLOR(0, 60, 30);
}

Then you should load your style sheet class into your app delegate:

[[[TTStyleSheet setGlobalStyleSheet:[[[StyleSheet alloc] init] autorelease]];
夏雨凉 2024-12-13 05:25:59

谢谢阿帕拉特,
这是我所做的 -

  1. 创建一个新类(就像创建新的视图控制器一样)
    命名 Stylesheet.hStylesheet.m
  2. .h 中导入 #import文件
  3. .m 文件中的UIViewController 替换为 TTDefaultStyleSheet
  4. 我放置了方法 navigationBarTintColor 和 首先在项目委托文件中的toolbarTintColor
  5. 我导入了 Stylesheet.h 然后在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary * 的第一行)launchOptions 我放置了 [TTStyleSheet setGlobalStyleSheet:[[[Stylesheet alloc] init] autorelease]];

就是这样:)

Thanx aporat,
Here is the stuff i did-

  1. Created a new class (simply as new viewcontroller is created) with
    name Stylesheet.h and Stylesheet.m
  2. imported #import <Three20Style/Three20Style.h> in .h file
  3. replaced UIViewController with TTDefaultStyleSheet
  4. in .m file i put the methods navigationBarTintColor and toolbarTintColor
  5. in project delegate file first i imported Stylesheet.h then on the 1st line of - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions i placed [TTStyleSheet setGlobalStyleSheet:[[[Stylesheet alloc] init] autorelease]];

THATS IT :)

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