3

I am just pushing another view from one view . the pushed view would appear transparent after this code . i have used it many times earlier . it is as simple as this .

settings *set = [[settings alloc] initWithNibName:@"settings" bundle:nil];
set.view.backgroundColor = [ [UIColor blueColor] colorWithAlphaComponent:0.3f];
[self.navigationController pushViewController:set animated:YES ];

But now with latest ios and xcode , pushed view does not become transparent anymore . so if anyone has any other solution for this then please let me know .

I already referred many posts regarding this like

and asked to many other members , but could not get the solution for this issue . this is page 1this is pushed page

Moxarth
  • 303
  • 4
  • 13
  • First, write question with proper formatting! And hows your pushed view looks ? add screenshot in question if possible! – Ketan Parmar Jun 28 '17 at 13:20
  • add this line in viewDidLoad of setting . self.view.backgroundColor = [ [UIColor blueColor] colorWithAlphaComponent:0.3f]; – KKRocks Jun 28 '17 at 13:22
  • it does not work @KKRocks . – Moxarth Jun 28 '17 at 14:34
  • Add line: self.navigationController.view.backgroundColor = [UIColor clearColor]; – ninjaproger Jun 28 '17 at 22:05
  • @Lion i have added screen shots . you can see that 1st page should be visible in background . but it is not here . i have used this many times before , but this time it is not working . – Moxarth Jun 29 '17 at 06:46
  • @ninjaproger i have tried that . it did not work . – Moxarth Jun 29 '17 at 06:49
  • --> TViewController *push = [[TViewController alloc] initWithNibName:@"TViewController" bundle:nil ]; --> self.navigationController.view.backgroundColor = [UIColor clearColor]; --> push.view.backgroundColor = [UIColor colorWithRed:127.0f/255.0f green:127.0f/255.0f blue:127.0f/255.0f alpha:0.6f] ; --> [self.navigationController pushViewController:push animated:YES]; i have tried this also . but no use . – Moxarth Jun 29 '17 at 06:52

1 Answers1

1

You should present your view controller instead of push, because with push, you can not achieve transparency that shows previous view controller!

You can debug view hierarchy to just check that how much views are between your top view and previous view.

To debug view hierarchy you can tap Debug View Hierarchy button enter image description here from debug area!

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
  • on pushed page there are other 3 views hierarchy between uiwindow and uiview . those are UiLayoutContainerView , UiNavigationTransitionView , UiViewcontrollerWrapperView . .. so you are saying that , to make uiview tranparent , we have to make all those in between 3 views transparent too , is it ? – Moxarth Jun 29 '17 at 09:13
  • yeah! may be i think! I haven't tried this kind of stuff but all view should have clear color which are stays between! I suggest you to present view controller instead of push! – Ketan Parmar Jun 29 '17 at 09:16
  • good approach . i ll try with present view also . but i was using these kinda coding before many times . i never faced problems before regarding this issue . – Moxarth Jun 29 '17 at 09:20
  • sorry for late reply , i have tried presenting view controller instead of push . but the answer is same . i did not work . – Moxarth Jul 06 '17 at 06:44