English 中文(简体)
无法将图像分配给图像 Array的观点,但可以把图像描绘成图像 A. 普遍定期审议变量的观点
原标题:Unable to assign images to an imageView from an Array, but can assign images to an imageView from a UIImage variable

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”词,则显示。

最佳回答

解决上述问题的办法(从www.iphonedevsdk.com获得“JSD”认证):

自选定幻灯以来 观点被装在刀子上,该观点第一次装上。

在我把我的阿雷拉图像分配给我之前,我必须列入以下编码线:

[selectSlideView view];
问题回答

你们可以第一次尝试直接装上图像,然后在随后ache。 (我排除了打字法和扩展法,但你在获得图像后可以添加。)

   If(tmpInt >-1 && tmpInt <9)
     {
      // Check if already cached
         self.selectSlideView.imageView.image = [self getButtonImages:tmpInt];
      // add scaling code here for smaller image

     }

在“执行”中,你可以补充:

 - (UIImage) getButtonImages:(NSInteger)index
    {   
        UIImage* myImage = [UIImage imageNamed:@"image%d.jpg", index];
        return myImage;
    }




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签