I have a brief for a share page which involves clicking on a share button and a modal view appearing over the top with some share functionality.
My issues is that i'd like the background of the modal view to be semi transparent and therefore show the view beneath. I've set the background properties of the modal layer and as the modal appears the layer beneath is briefly visible - and looks exactly as I require - but as soon as the cover transition is complete the background view is hidden - is there any way around this?
(Using IOS7 by the way)
Cheers
Update - @Tommaso Resti has kindly helped me try and figure this issue out - to explain what I've done so far - my main storyboard contains an unlinked uiview with the identifier 'ShareScreenView' - which I would like to add to my mainView as a transparent modal when clicking on a button. I have linked the button as an IBAction and added the following to my method -
- (IBAction)shareBtn:(id)sender {
NSLog(@"clicked");
/* Create your view off the screen (bottom) */
/* NEW EDIT */
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main_iPhone"
bundle: nil];
UIViewController *myModalController = [mainStoryboard instantiateViewControllerWithIdentifier:@"ShareScreenView"];
[myModalController.view setFrame:CGRectMake(0, 568, 320, 568)];
// [myModalController.view setFrame: CGRectMake(0, [[UIScreen mainScreen].bounds.size.height], [[UIScreen mainScreen].bounds.size.width], [[UIScreen mainScreen].bounds.size.height])];
/* Animate it from the bottom */
[UIView animateWithDuration:.5 animations:^{
CGAffineTransform move = CGAffineTransformMakeTranslation(0, -[UIScreen mainScreen].bounds.size.height);
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
myModalController.view.transform = move; /* UPDATED HERE */
NSLog(@"Atrying");
} completion:^(BOOL finished) {
NSLog(@"Adid try");
if(finished) {
NSLog(@"Animation completed");
}
}];
}
But I get an error on the line -
[myModalController.view setFrame: CGRectMake(0, [[UIScreen mainScreen].bounds.size.height], [[UIScreen mainScreen].bounds.size.width], [[UIScreen mainScreen].bounds.size.height])];
which simply states 'expected identifier' with an arrow pointing at height (see screen shot below)
so I tried adding the properties as follows -
[myModalController.view setFrame:CGRectMake(0, 568, 320, 568)];
now there are no errors - but nothing happens and no errors..