ImageView与桌面视图一起滚动
问题描述:
在我的应用程序中,我在上面的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];
答
没有看到更多的代码,它看起来好像你可能使用UITableViewController
而不是UIViewController
。在最后一行[self.view addSubview:currentLocationImageView]
的情况下,两者之间的差异很重要。在UIViewController
中做的是将它添加到将包含tableview和imageview的视图中。但是,在UITableViewController
中,self.view
属性拥有tableview本身,因此,它将图像视图作为tableview的子视图进行广告,并将其视为tableview的滚动行为。
你可以做的是改变使用UITableViewController(可能对你的应用程序来说微不足道,但可能不是微不足道的,这取决于你首先选择使用它的原因);而且还需要显式创建tableview,并将其添加到您正在编写的UIViewController
子类的后备视图中 - 类似于如何添加上面的imageview。
希望这会有所帮助。