2009-11-25 67 views
0

我有問題顯示圖像....它在模擬器上完美工作,但在iPhone設備上它不工作....這裏是它的代碼...模擬器 - iPhone上的設備問題 - 圖像顯示方式有所不同

請幫助 -

UIView *shareView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 95)]; 
    shareView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bgImage.png"]]; 


    UIButton *button1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 64, 95)]; 
    UIImage *icon1 = [UIImage imageNamed:@"icon1.png"]; 
    [button1 setImage:icon1 forState:UIControlStateNormal]; 
    [button1 addTarget:self action:@selector(sendEmail) forControlEvents:UIControlEventTouchDown]; 
    [shareView addSubview:button1]; 

    UIButton *button2 = [[UIButton alloc] initWithFrame:CGRectMake(64, 0, 64, 95)]; 
    UIImage *icon2 = [UIImage imageNamed:@"icon2.png"]; 
    [button2 setImage:icon2 forState:UIControlStateNormal]; 
    [shareView addSubview:button2]; 

    UIButton *button3 = [[UIButton alloc] initWithFrame:CGRectMake(128, 0, 64, 95)]; 
    UIImage *icon3 = [UIImage imageNamed:@"icon3.png"]; 
    [button3 setImage:icon3 forState:UIControlStateNormal]; 
    [shareView addSubview:button3]; 

    UIButton *button4 = [[UIButton alloc] initWithFrame:CGRectMake(192, 0, 64, 95)]; 
    UIImage *icon4 = [UIImage imageNamed:@"icon4.png"]; 
    [button4 setImage:icon4 forState:UIControlStateNormal]; 
    [shareView addSubview:button4]; 

    UIButton *button5 = [[UIButton alloc] initWithFrame:CGRectMake(256, 0, 64, 95)]; 
    UIImage *icon5 = [UIImage imageNamed:@"icon5.png"]; 
    [button5 setImage:icon5 forState:UIControlStateNormal]; 
    [shareView addSubview:button5]; 


    [shareCell.contentView addSubview:shareView]; 
+0

這是什麼,確切地說,這不是按預期工作?也許你可以採取一些比較截圖? – 2009-11-25 23:02:11

回答

1

做過的.app文件夾(你通過iTunes iPhone設備上安裝)包含了所有的圖片? 在我的應用程序中,我遇到了同樣的問題,因爲我想要顯示的圖像不存在於.app文件夾中。

+0

我的問題已解決。我只是將所有圖像文件複製到.app文件夾。並再次構建應用程序。 – Pravara 2009-12-24 09:13:05

相關問題