0

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;
}
  • Possible duplicate :-http://stackoverflow.com/questions/3422915/scrolling-a-uitableview-inside-a-uiscrollview – Rushabh Feb 28 '14 at 13:06
  • get the page number of scrollview.when the content you want to display is displayed fully,set alpha of the scrollview to 0 at the final page.Try. – Madhur Sodhi Feb 28 '14 at 13:13
  • @Rushabh Thank you for your suggestion but in my case tableview is not a subview of scrollview it's subview os self.view – Dinesh Reddy Chennuru Feb 28 '14 at 13:44
  • @Madhur Sodhi in my case the scrollview must be available up to the centre of the screen it won't completely disappear.And the remaining half of the screen tableview has to appear. – Dinesh Reddy Chennuru Feb 28 '14 at 13:53
  • Can you clearly explain what you want to get. Why tableview and scrollview intersect? Why you want to show content of scrollview over tableview? – Oleg Sobolev Feb 28 '14 at 14:22
  • once the user select a row of a tableview i am pushing to the next viewController in that (the ViewController what we are discussing) I am displaying the details of selected row in scrollview and at the end of that I have to display the background tableview which also contain all the detials like previous viewcontroller's tableView. – Dinesh Reddy Chennuru Feb 28 '14 at 15:03
  • Or else is there any way to set alpha to the particular area of scrollview – Dinesh Reddy Chennuru Mar 13 '14 at 13:18

0 Answers0