【发布时间】:2013-11-15 10:01:30
【问题描述】:
我有一个分享页面的简介,其中包括单击分享按钮和显示在顶部的模式视图,其中包含一些分享功能。
我的问题是我希望模态视图的背景是半透明的,因此在下面显示视图。我已经设置了模态层的背景属性,当模态出现时,下面的层是短暂可见的 - 看起来完全符合我的要求 - 但是一旦封面转换完成,背景视图就会隐藏 - 有什么办法吗这个?
(顺便用IOS7)
干杯
更新 - @Tommaso Resti 帮助我尝试解决这个问题 - 解释我到目前为止所做的事情 - 我的主故事板包含一个未链接的 uiview 标识符为“ShareScreenView” -单击按钮时,我想将其作为透明模式添加到我的 mainView 中。我已将按钮链接为 IBAction,并将以下内容添加到我的方法中 -
- (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");
}
}];
}
但我在线上遇到错误 -
[myModalController.view setFrame: CGRectMake(0, [[UIScreen mainScreen].bounds.size.height], [[UIScreen mainScreen].bounds.size.width], [[UIScreen mainScreen].bounds.size.height ])];
它只是用指向高度的箭头声明“预期标识符”(见下面的屏幕截图)
所以我尝试按如下方式添加属性 -
[myModalController.view setFrame:CGRectMake(0, 568, 320, 568)];
现在没有错误 - 但什么也没发生,也没有错误..
【问题讨论】:
标签: ios objective-c modalviewcontroller