2011-01-24 80 views
1

在我的應用程序中,我在上面的tabbar上創建了一個imageview。我想在這裏顯示一些圖像來顯示一些添加。 什麼我的實際問題是...我加入這個對我表視圖,每當我滾動表視圖,我的ImageView也scrolling.Please幫我在這advance.HereImageView與桌面視圖一起滾動

感謝是我的代碼

UIImageView *currentLocationImageView = [[UIImageView alloc] init]; 
NSURL *url1 = [NSURL URLWithString:@"http://imgsrv.995themountain.com/image/kqmt2/UserFiles/Image/SiteGraphics/MTNVideos360x80.jpg"]; 
UIImage *img1 = [UIImage imageWithData: [NSData dataWithContentsOfURL:url1]]; 
NSURL *url2 = [NSURL URLWithString:@"http://download.xbox.com/content/images/35f6c527-fb73-40d3-bcb9-bdea2680bc03/1033/banner.png"]; 
UIImage *img2 = [UIImage imageWithData: [NSData dataWithContentsOfURL:url2]]; 

NSArray *images = [NSArray arrayWithObjects:img1, img2, nil]; 
[currentLocationImageView setAnimationImages:images]; 
[currentLocationImageView setAnimationRepeatCount:0]; 
[currentLocationImageView setAnimationDuration:5.0]; 
currentLocationImageView.frame = CGRectMake(0.0, 340.0, 320.0, 30.0); 
//self.tableView.tableFooterView = currentLocationImageView; 
[currentLocationImageView startAnimating]; 
[self.view addSubview:currentLocationImageView]; 

回答

1

沒有看到更多的代碼,它看起來好像你可能使用UITableViewController而不是UIViewController。在最後一行[self.view addSubview:currentLocationImageView]的情況下,兩者之間的差異很重要。在UIViewController中做的是將它添加到將包含tableview和imageview的視圖中。但是,在UITableViewController中,self.view屬性擁有tableview本身,因此,它將圖像視圖作爲tableview的子視圖進行廣告,並將其視爲tableview的滾動行爲。

你可以做的是改變使用UITableViewController(可能對你的應用程序來說微不足道,但可能不是微不足道的,這取決於你首先選擇使用它的原因);而且還需要顯式創建tableview,並將其添加到您正在編寫的UIViewController子類的後備視圖中 - 類似於如何添加上面的imageview。

希望這會有所幫助。

相關問題