【发布时间】:2010-05-16 18:48:40
【问题描述】:
我正在使用以下代码添加模式视图:
[self presentModalViewController:phrasesEditor animated:YES];
如何使模态视图半透明,以便超级视图“发光”?
我的完整方法/功能如下所示:
-(IBAction)showEditPhrases:(id)sender{
PhrasesViewController *phrasesEditor = [[PhrasesViewController alloc] initWithNibName:@"PhrasesViewController" bundle:nil];
phrasesEditor.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[phrasesEditor.view setAlpha: 0.5];
[phrasesEditor.view setBackgroundColor: [UIColor clearColor]];
[self presentModalViewController:phrasesEditor animated:YES];
[phrasesEditor release];
}
编辑:
显然,更改 alpha 的务实方法行不通。如何将 NIB 加载到 UIView 并与之交互?
我现在有一个 UIViewController。我是将其转换/修改/更改为 UIVIew 然后加载它,还是我应该做其他事情?
编辑 2:
我尝试了[self.view addSubview:phrasesEditor.view];,但这让我无法删除子视图。每个视图似乎都有自己的视图控制器。
编辑 3:
我想我应该提一下,超级视图位于名为 iDecideViewController 的视图控制器内,而短语编辑器有一个单独的视图控制器。
【问题讨论】:
标签: iphone modal-dialog