TTNavigator and TTStyleSheet

30 views
Skip to first unread message

CG

unread,
Mar 23, 2011, 10:23:00 AM3/23/11
to Three20
Hi,

I'm setting a global style sheet to change the navigationBarTintColor
in my app delegate like this:

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

That is working just fine, except when when my app state is restored
by calling restoreViewControllers in TTNavigator. In that case, the
navigation bar is showing the iOS default, pale blue color. When I
navigate on to the next view, the style sheet takes effect again.

I would really appreciate any hints on this...

Best regards,
Christian

Robert Mathews

unread,
Mar 23, 2011, 1:12:25 PM3/23/11
to thr...@googlegroups.com
Have you tried putting something in

- (void)applicationDidBecomeActive:(UIApplication *)application;

?

I'd be tempted to try setting the navbar color directly from there.

The other thing I notice is that my views tend to have this:

- (void)viewDidAppear:(BOOL)animated
{
   self.navigationController.navigationBar.tintColor
}

which works, but is obviously less than ideal.

Rob.




--
We are moving away from Google Groups as our primary community in favor of a new, custom-made Vanilla forums setup. Please start asking questions there going forward. We will continue supporting the Three20 Google Group at least until April 9th of 2011.

http://forums.three20.info/

To learn more about Three20, check out
http://Three20.info/

You received this message because you are subscribed to the Google
Groups "Three20" group.
To post to this group, send email to thr...@googlegroups.com
To unsubscribe from this group, send email to
three20+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/three20?hl=en

elpuerco63

unread,
Mar 23, 2011, 7:23:26 PM3/23/11
to thr...@googlegroups.com, thr...@googlegroups.com
The approach Robert states in viewDidAppear is the way I do it but in viewWillAppear instead

ep


CG

unread,
Mar 24, 2011, 8:23:38 AM3/24/11
to Three20
Robert, ep,

Thank you very much for your quick responses. I implemented a common
super class for my view controllers now and added the following
method, following your suggestions:

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (self.navigationController) {
self.navigationController.navigationBar.tintColor =
TTSTYLEVAR(navigationBarTintColor);
}
}

While this does solve my problem for now, it surely feels like a bad
work-around, though.

Anyway, thanks again.

Christian.

Robert Mathews

unread,
Mar 24, 2011, 9:33:30 AM3/24/11
to thr...@googlegroups.com, CG
Exactly - it's bad layering, the view reaches up to its parent and twiddles a property that is logically part of the parent view, not itself.

Also, for what it's worth, you could use a category to override viewWillAppear, instead of inheritance.


Christian.

Alaa Nassef

unread,
Mar 24, 2011, 9:40:36 AM3/24/11
to thr...@googlegroups.com, Robert Mathews, CG
I used a category to solve the exact problem.

CG

unread,
Mar 24, 2011, 10:17:45 AM3/24/11
to Three20
Yes, I thought about using a category, too. But I already had a super
class in place that all affected view controllers were descending
from. Also, I noticed that controllers inheriting from
TTViewController were not affected and I was afraid to break something
down that branch of classes...

On 24 Mrz., 14:33, Robert Mathews <r...@justsoftwareconsulting.com>
wrote:
Reply all
Reply to author
Forward
0 new messages