0
我有一個頁面控制器和這樣定義的方法pageAction:的PageController和TableView中
-(void)pageAction:(UIPageControl*)control
{
NSLog(@"page changed");
[self getVehicules];
[self.tableViewVehiculesPossedes release];
int page = pageControlVehiculePossedee.currentPage;
NSLog(@"page %d", page);
[self loadScrollViewWithPage:page];
CGRect frame = pageControlVehiculePossedee.frame;
frame.origin.x = (vosvehiculeScrollView.frame.size.width * page);
[vosvehiculeScrollView scrollRectToVisible:frame animated:YES];
pageControlUsed = YES;
}
每次我改變我需要顯示一些標籤一個實現代碼如下頁面。下面是代碼:
- (void)viewDidLoad
{
[super viewDidLoad];
[self getVehicules];
vosvehiculeScrollView.pagingEnabled = YES;
vosvehiculeScrollView.showsHorizontalScrollIndicator = NO;
vosvehiculeScrollView.showsVerticalScrollIndicator = NO;
vosvehiculeScrollView.scrollsToTop = NO;
pageControlVehiculePossedee.numberOfPages=[vehiculesPossede count];
pageControlVehiculePossedee.currentPage=0;
[self loadScrollViewWithPage:0];
[pageControlVehiculePossedee addTarget:self action:@selector(pageAction:) forControlEvents:UIControlEventValueChanged];
[email protected]"Votre véhicule";
vehiculesPossedesArray = [[NSMutableArray alloc] initWithObjects:@"Annee modele", @"Transmission",@"Carburant", nil];
}
- (void) loadScrollViewWithPage: (int) page {
if (page < 0) return;
if (page >= [vehiculesPossede count]) return;
tableViewVehiculesPossedes=[[UITableView alloc] initWithFrame:CGRectMake(3, 80, 315, 171) style:UITableViewStyleGrouped];
tableViewVehiculesPossedes.tag=page;
tableViewVehiculesPossedes.bounces=NO;
tableViewVehiculesPossedes.backgroundColor=[UIColor clearColor];
[tableViewVehiculesPossedes setDelegate:self];
[tableViewVehiculesPossedes setDataSource:self];
[self.vosvehiculeScrollView addSubview:tableViewVehiculesPossedes];
nameVehiculeLabel.text=[[vehiculesPossede objectAtIndex:page] valueForKey:@"modele"];
self.transmissionString=[[vehiculesPossede objectAtIndex:page]valueForKey:@"transmision"];
self.carburantString=[[vehiculesPossede objectAtIndex:page] valueForKey:@"carburant"];
self.anneeModelString=[[vehiculesPossede objectAtIndex:page] valueForKey:@"modele_annee"];
self.anneeString=[[vehiculesPossede objectAtIndex:page]valueForKey:@"annee"];
if(page==0){
NSLog(@"0");
[email protected]"ttt";
}
else NSLog(@"1");
}
的問題是,即使我把[self.tableViewVehiculesPossedes release];
上的改變頁面的方法,在出現的tableView覆蓋和標籤文本被重疊。我可以用tableview做些什麼來使它在新頁面顯示時消失?
請幫助我..我花了很多時間: