UA-17470720-3

Jump to content


Photo
- - - - -

Cosmetic Issue of ModalView Controller - Would Like Transparent Background


  • Please log in to reply
4 replies to this topic

#1 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 24 August 2015 - 04:59 AM

Members,

 

Posting a cosmetic issue (not an STV issue).

 

STV 5.0 with storyboard design rocks!  STV allows me to "Generate New Item View" and "Generate Detail View" directly in IB...

 

By design I would like me tableView to be transparent - with a visual color background set from code...

 

  1. When viewing a new item the background momentarily is transparent (showing the background colour I wish to use) and then flashes to a black background... as this view is a modalView (automatically generated by STV)...
     
  2. When detail view is presented - no problem as the view is pushed...

I have been looking around stack overflow for a solution when presenting the modalView with transparent background, but have had no luck.  No matter what code I use, the modalView is always transparent (for a second) and then goes black (not transparent)...

 

Any ideas (see screen shots) for work flow.  In my case when pushed all is good, when presented modally, not good.

 

John

 

Attached File  iOS Simulator Screen Shot Aug 24, 2015, 8.39.46 AM.png   121.15K   7 downloads

 

Attached File  iOS Simulator Screen Shot Aug 24, 2015, 8.39.50 AM.png   35.12K   9 downloads

 

Attached File  iOS Simulator Screen Shot Aug 24, 2015, 8.39.59 AM.png   126.32K   6 downloads

 

Attached File  iOS Simulator Screen Shot Aug 24, 2015, 8.40.04 AM.png   143.83K   3 downloads

 

 

 



#2 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 511 posts
  • LocationAustralia
Reputation: 165
Popular

Posted 24 August 2015 - 03:12 PM

so for me none of mine ever push one colour then turn black.. so there might just be some code or style sheet setting you have that is overriding it when it shows..

 

since i can't see your code etc, try deleting all the code behind and see what happens when its run, and then piece by piece add your code back to see which part is doing the wrong thing

 

Else if you can, zip up your demo app and upload it so someone might be able to have a quick look and see whats going on


Edited by ozie, 24 August 2015 - 03:13 PM.

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#3 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 24 August 2015 - 04:38 PM

Thanks Ozie...

 

I want to be clear (as it may be semantics) but this is not a problem on "push" segue only modal...

 

I have provided a screen cap to better illustrate.  I am sure you are correct though - it is my code... I will try to figure out - if not I zip the file to you to review...

 

Thanks for the advice...

 

John

Attached Files



#4 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 24 August 2015 - 07:55 PM

Fixed...

 

I had to add a viewWillAppear for the modal views... below is my code... but most important part is...

 

            

            UIImage *image = [UIImage imageNamed:@"YourBackgroundImageName"];

            self.tableView.backgroundView = nil;

            self.view.backgroundColor = [UIColor colorWithPatternImage:image];

            

    

      

Here is my actual code... I actually have a switch that allows users to select two different background colors...

 

// I need this viewWillAppear as without it the tableView using modal segue will be empty (black background)...

 

- (void)viewWillAppear:(BOOL)animated

{

    [super viewWillAppear:animated];

    

    {

        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"MySwitch"])

        {

            [self.backgroundSwitch setOn:YES animated:YES];

            

            UIImage *image = [UIImage imageNamed:@"GreenBackground"];

            self.tableView.backgroundView = nil;

            self.view.backgroundColor = [UIColor colorWithPatternImage:image];

            

    

        }

        else

        {

            [self.backgroundSwitch setOn:NO animated:YES];

            

            UIImage *image = [UIImage imageNamed:@"RedBackground"];

            self.tableView.backgroundView = nil;

            self.view.backgroundColor = [UIColor colorWithPatternImage:image];

            

        }

        

    }

    

}


  • Tarek likes this

#5 designwerks

designwerks

    Advanced Member

  • STV 5.0 Std
  • PipPipPipPipPip
  • 133 posts
  • LocationKingsville, Ontario, Canada
Reputation: 22
Excellent

Posted 25 August 2015 - 05:40 PM

Actually,

 

For those of you interested,  the following code can be use in leu of the above code for a cleaner effect. (at least in my case)...

 

self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"YourBackgroundImageName"]];

 

John...






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users