I have a problem with arrays and passing images between views that I would like some help on! So the background is that I have:
• 根基 (处理我的意见)
• 处理表格中选定内容细节的通讯员
• 显示从通信观察台上点击的图像并允许用户从摄像机中选取不同的图像的排气机
因此,问题:
• 在“通信记录员”中,如果用户点击ton子,我有以下代码:
- (IBAction) selectSlide:(id) sender
{
if(self.selectSlideView == nil)
{
SelectSlideViewController *viewController = [[SelectSlideViewController alloc]
initWithNibName:@"SelectSlideViewController" bundle:[NSBundle mainBundle]];
self.selectSlideView = viewController;
[viewController release];
}
[self.navigationController pushViewController:self.selectSlideView animated:YES];
self.selectSlideView.cmn = cmn;
self.selectSlideView.title = cmn.name;
self.selectSlideView.imageView.image = self.myImage5;
}
例如,如果我点击了5顿语,那么上述代码就能够发挥作用,因为它在“SelectSlideViewController”中树立了形象5。
然而,我要用同样的“幻灯片”行动有多个县,为此,我需要从一系列图像(或一系列星号)中向“SelectSlideViewController”提供正确的形象。
• 因此,我修订后的法典如下,但它没有与阵列——任何想法——合作?
- (IBAction) selectSlide:(id) sender
{
if(self.selectSlideView == nil)
{
SelectSlideViewController *viewController = [[SelectSlideViewController alloc]
initWithNibName:@"SelectSlideViewController" bundle:[NSBundle mainBundle]];
self.selectSlideView = viewController;
[viewController release];
}
NSUInteger tmpInt = -1;
tmpInt = [buttonArray indexOfObject:sender];
[self.navigationController pushViewController:self.selectSlideView animated:YES];
self.selectSlideView.cmn = cmn;
self.selectSlideView.title = cmn.name;
NSLog(@"The int was %d",tmpInt);
NSLog(@"This is the image array size %d ",[imageArray count]);
If(tmpInt >-1 && tmpInt <9)
{
self.selectSlideView.imageView.image = [imageArray objectAtIndex:tmpInt];
}
/** this code works, but is a bit clunky:
if(tmpInt == 0)
self.selectSlideView.imageView.image = self.myImage1;
else if (tmpInt == 1)
self.selectSlideView.imageView.image = self.myImage2;
else if (tmpInt == 2)
self.selectSlideView.imageView.image = self.myImage3;
else if (tmpInt == 3)
self.selectSlideView.imageView.image = self.myImage4;
else if (tmpInt == 4)
self.selectSlideView.imageView.image = self.myImage5;
else if (tmpInt == 5)
self.selectSlideView.imageView.image = self.myImage6;
else if (tmpInt == 6)
self.selectSlideView.imageView.image = self.myImage7;
else if (tmpInt == 7)
self.selectSlideView.imageView.image = self.myImage8;
else if (tmpInt == 8)
self.selectSlideView.imageView.image = self.myImage9;
**/
}
我已肯定地确认,图像Aray的面积为9,正在从阵列中提取正确的指数,但是,如果从阵列中获取,选择性幻灯片确实显示图像。 如果使用“cl”词,则显示。