UITableView没有显示数据,用作iCarousel View

时间:2014-06-05 10:47:16

标签: ios uitableview icarousel

(制作iPad应用)在我的iCarousel中,有两个UITableViews,当我向下一个iCarousel视图移动时,我UITableView无法获得任何内容。当我保持numberOfRowsInsection不变时,就没有问题了。但是,当我尝试更改datasource UITableView NSRangeException时,我UTableView#pragma mark-Table View Methods - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 5; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSInteger carouselIndex = [self.carousel indexOfItemViewOrSubview:tableView]; static NSString *CellIdentifier = @"cell"; NSArray *array= [[NSBundle mainBundle] loadNibNamed:@"toursViewTableCell" owner:self options:nil]; toursViewTableCell *cell = (toursViewTableCell*) [array objectAtIndex:0]; switch (carouselIndex) { case 0: if (tableView.tag==111) { if (cell==nil) { cell= [[toursViewTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } //setting dataSource dateArrayInTableCellOne=[[NSMutableArray alloc] initWithObjects:@"2014-05-08",@"2014-05-09",@"2014-05-11",@"2014-05-13",@"2014-05-14", nil]; cityArrayInTableCellOne=[[NSMutableArray alloc] initWithObjects:@"Santa Cruz",@"Redding",@"Portland",@"Boise",@"Salt Lake City", nil]; stateArrayInTableCellOne=[[NSMutableArray alloc] initWithObjects:@"CA",@"CA",@"OR",@"ID",@"UT" ,nil]; venueArrayInTableCellOne=[[NSMutableArray alloc] initWithObjects:@"Catalyst Club",@"Cascade Theater",@"Alladin Thearter",@"Knitting Factory",@"The Depot", nil]; //setting Cell }else if (tableView.tag==222){ //setting dataSource for second tableView dateArrayInTableCellTwo=[[NSMutableArray alloc] initWithObjects:@"2014-03-04",@"2014-03-05",@"2014-03-07",@"2014-03-08",@"2014-03-11", nil]; cityArrayInTableCellTwo=[[NSMutableArray alloc] initWithObjects:@"Richmond",@"Newport News",@"Charleston",@"Louisville",@"Des Moines", nil]; stateArrayInTableCellTwo=[[NSMutableArray alloc] initWithObjects:@"VA",@"VA",@"WV",@"KY",@"IA",nil]; venueArrayInTableCellTwo=[[NSMutableArray alloc] initWithObjects:@"Carpenter Center",@"Christopher Newport Univ.",@"Clay Center for the Arts & Sciences",@"Palace Theatre",@"Civic Center of Greater Des Moines", nil]; //Setting Cell } break; //Carousel Index Changed case 1: if (tableView.tag==111) { //I am not getting anything here,If i reload tableView . If i dont reload tableView I am getting NSRangeException. //Changing dataSource newDateArrayInTableCellOne=[[NSMutableArray alloc] initWithObjects:@"2014-01-16",@"2014-01-28",@"2014-01-29", nil]; newCityArrayInTableCellOne=[[NSMutableArray alloc] initWithObjects:@"Santa Barbara",@"New York City", nil]; newStateArrayInTableCellOne=[[NSMutableArray alloc] initWithObjects:@"CA",@"NY",@"NY", nil]; newVenueArrayInYableCellOne=[[NSMutableArray alloc] initWithObjects:@"The Lobero Theatre",@"City Winery",@"City Winery", nil]; //setting Cell For Carousel Index One }else if (tableView.tag==222){ //Setting TabeViewCell For Carousel Index One } break; 中没有任何内容。以下是我所做的代码。  请帮忙。我被困在这里。

{{1}}

这是screenShot我要做的事情。enter image description here

0 个答案:

没有答案