Welcome, Guest
Username Password: Remember me

Detail View Navigation Bar Color
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: Detail View Navigation Bar Color

Detail View Navigation Bar Color 1 year, 7 months ago #1

I am using the SCTableViewCellDelegate method:

- (void)detailViewWillAppearForCell:(SCTableViewCell *) cell  withDetailTableViewModel:(SCTableViewModel *) detailTableViewModel
 


to customize my detail view for a SCSelectionCell. I have everything set up that I need, but I can't figure out how to change the style/color of the navigation bar. I tried using:

detailTableViewModel.viewController.navigationController.navigationBar.barStyle = UIBarStyleBlack;


and:

detailTableViewModel.viewController.navigationController.navigationBar.tintColor = [UIColor blackColor];


with no success. I believe this is because the UINavigationBar has already been created before this method is called. Am I missing something?

Thanks!
  • icyplains
  • OFFLINE
  • Expert Boarder
  • Posts: 133
  • Karma: 5

Re: Detail View Navigation Bar Color 1 year, 7 months ago #2

The SCSelectionCell detail view shares the same navigation bar as your main/root view controller. Furthermore, if Sensible TableView displays any detail view modally with its own navigation bar, it will inherit its parent's navigation bar style. Is what you're looking for is having a different style for the detail view than that of the root view?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72
Last Edit: 1 year, 7 months ago by tarekskr.

Re: Detail View Navigation Bar Color 1 year, 7 months ago #3

One of my view controllers has a button "Edit Profile." When the user taps the button, I have another view controller that has a UINavigationBar that I added via IB. It is there to hold the "Save" and "Cancel" buttons and is displayed modally.

This is the view controller that uses STV and has the "Gender" SCSelectionCell. When the user taps the Gender cell to make a selection of Male or Female, that detail view is the one that has the default blue UINavigationBar, if that makes sense
  • icyplains
  • OFFLINE
  • Expert Boarder
  • Posts: 133
  • Karma: 5

Re: Detail View Navigation Bar Color 1 year, 7 months ago #4

If I understand you correctly, all you need to do is set the UINavigationBar style in IB to Black, and SCSelectionCell should use that. Also, if you like, you can send your project to our support email and we'll quickly do it for you.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2404
  • Karma: 72

Re: Detail View Navigation Bar Color 1 year, 7 months ago #5

I have it set to black in IB.

The problem might be, that none of them are part of a navigation stack.

Just to clarify/re-iterate:

My "Home" view controller is a child of my UITabBarController. "Home" is just a UIViewController and not a UINavigationController and does not have a UINavigationBar.

Once the "Edit Profile" button has been tapped, the Home view controller displays the view controller that uses SCTV. I built this VC in IB and added a UINavigationBar and have its style set to Black.

When Gender is selected and the detail view is pushed, its navigation bar is the default blue.


It sounds like what I'm doing is unconventional. I will play around and try to find a workaround!
  • icyplains
  • OFFLINE
  • Expert Boarder
  • Posts: 133
  • Karma: 5

Re: Detail View Navigation Bar Color 1 year, 7 months ago #6

OK, I found a workaround by editing the SCTV source code. I added the "else" inside the code block below.


SCTableViewCell.m

Inside the "else" that starts on line 2369.

if(navController)
detailNavController.navigationBar.barStyle = navController.navigationBar.barStyle;
else
detailNavController.navigationBar.barStyle = UIBarStyleBlack;
  • icyplains
  • OFFLINE
  • Expert Boarder
  • Posts: 133
  • Karma: 5
Last Edit: 1 year, 7 months ago by icyplains.
  • Page:
  • 1
  • 2
Time to create page: 1.04 seconds