I've looked around and i can't seem to figure out this.
I'm simply trying to show a view on top of another one, but from another VC , and in storyboard .
The "idea" behinf this view is a kind of a pop-up/alert, and it'll eventually need a collection view and multiple buttons. So i figured i'd just do that with another VC since i need that "popup" in many places in the app.
Right now, i can do it, but my view is not transparent (even though my alpha is set correctly), so I'm guessing that the "under" view is actually gone and i've just made a regular "segue" using a different method. So i'm stuck.
And I cant just copy paste the whole VC class everywhere i need it so i can "addsubview" it...
Any idea?
This is what i'm doing :
AddFeelingViewController *adf = (AddFeelingViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"AddFeelingViewController"];
adf.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:adf animated:YES completion:nil];
The view appears and i can interact, but since it's very small i just need a "transparent background" which i haven't. Also, i'm planning to have a fullscreen button that removes the view. The classic "hit somewhere to cancel" type of button.
Any help is much appreciated !
You should check this project on Github, it has exactly what you need in "custom transition".
https://github.com/schneiderandre/popping
It was created using the Facebook pop animation engine.
Here is a way to get alpha value but you could instead of presenting the viewController, you could simply add it to current view as subview along with alpha value as shown below :-
-(IBAction)newView:(id)sender {
demoVc = (YOUR_VIEW_CONTROLLER *)[self.storyboard instantiateViewControllerWithIdentifier:@"identifier"];
demoVc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[demoVc.view setAlpha:0.3]; //Set alpha value
// [self presentViewController:demoVc animated:YES completion:nil];
[self.view addSubview:demoVc.view];
}
Also to remove you could simple create a IBAction method to remove it from superview.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.