UIImageView消失了

时间:2011-03-08 08:11:25

标签: iphone

我遇到了UIImageView的一些问题。

在我当前的项目中,我有一个包含TableView和动画ImageView的页面,我想在页面中添加第二个(非动画)ImageView,但这样做会导致第一个ImageView消失,新的显示只是精细。这只发生在不在模拟器中的设备上。

代码:

- (void)loadView
{

   //The new ImageView.

NSString *fillerPath = [[NSBundle mainBundle] pathForResource:@"pngImage" ofType:@"png"];
NSData *fillerData = [[NSData alloc]initWithContentsOfFile:fillerPath];  
UIImage *filler = [[UIImage alloc]initWithData:fillerData];  
fillerView = [[UIImageView alloc]initWithImage:filler];  
[fillerData release];  
[filler release];

   //The old ImageView.

banner = [[UIImageView alloc]init];  
banner.animationImages = nBanners;  
banner.animationDuration = [nBanners count] * 8;  
banner.animationRepeatCount = 0;

[[self view] addSubview:fillerView];  
[[self view] addSubview:banner];

[banner startAnimating];  
}

- (void) viewDidAppear:(BOOL)animated  
{  
CGRect screen = [[UIScreen mainScreen] bounds];  
CGSize screenSize = screen.size;  

   [banner setFrame:CGRectMake(0, screenSize.height*0.62, screenSize.width, screenSize.height *0.15)];    
   [fillerView setFrame:CGRectMake(0, screenSize.height * 0.56, screenSize.width, screenSize.height * 0.06)];  
}

0 个答案:

没有答案