I have a scrollView
and background of it I have another tableview
.Now when I scroll at the end of the scrollview
after displaying all the content I am displaying background tableview
by setting scrollview background color as clear color.
Now the question is how to enable background tableview
to scroll?
Any suggestions would be appreciated! Thank you
Here Is My Code
- (void)viewDidLoad
{
[super viewDidLoad];
tableViewScroll=[[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
[tableViewScroll setFrame:CGRectMake(0, 250, 320, 300)];
[tableViewScroll setDelegate:self];
[tableViewScroll setDataSource:self];
[self.view addSubview:tableViewScroll];
UIScrollView *scroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 560)];
[scroll setUserInteractionEnabled:YES];
[scroll setBackgroundColor:[UIColor clearColor]];
[scroll setDelegate:self];
UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 700)];
[label setBackgroundColor:[UIColor lightGrayColor]];
[scroll addSubview:label];
[scroll setContentSize:CGSizeMake(320,label.frame.size.height+tableViewScroll.frame.size.height)];
[self.view addSubview:tableViewScroll];
[self.view addSubview:scroll];
}
Table View Delegate Methods
-(int)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 150;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"Dinesh"];
if(cell==nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Dinesh"];
}
[cell.textLabel setText:[NSString stringWithFormat:@"Text:%d",indexPath.row]];
return cell;
}