【发布时间】:2010-03-22 19:21:30
【问题描述】:
我想从 4-6 个图标的弹出对话框中更改视图上的图像(想象一下,就像在信使应用程序上更改图像一样)。 我实现此模式弹出窗口的方式是在 IB 上创建一个新视图,背景为不透明,然后将其加载为子视图:
IconsViewController *iconsViewController = [[IconsViewController alloc] initWithNibName:@"IconsView" bundle:nil];
[self.view addSubview:iconsViewController.view];
所以,当用户触摸一个图标时,我有
- (IBAction)iconIsSelected:(id)sender {
switch ([sender tag]) {
case 1:
[(ParentViewController*)[self superview] changeIcon];
break;
case 2:
// same here..
break;
default:
break;
}
[self.view removeFromSuperview];
[self release];
}
changeIcon 只是将image 设置为相应的图标。
您可以猜到,这不起作用 - changeIcon 消息永远不会起作用。
我不明白我做错了什么,非常感谢任何帮助!
【问题讨论】:
标签: iphone uiview uiimageview uiimage addsubview