There are two tableview_android in the Uiscrollerview of Android program development.

Source: Internet
Author: User

One, the effect chart.

Second, engineering drawings.

Three, code.

RootViewController.h

#import <UIKit/UIKit.h>
@interface rootviewcontroller:uiviewcontroller
<uiscrollviewdelegate, Uitableviewdelegate,uitableviewdatasource>
{
  uiscrollview *_scrolview;
  UITableView *_tableview;
  UITableView *_tableview2;
  UITableViewCell *_cell;
}

Rootviewconroller.m

 #import "RootViewController.h" @interface Rootviewcontroller () @end @implementation Rootviewcontroller-(ID) initwithn Ibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornil {self = [super Initwithnibname:nibnameornil bundle:n
  Ibbundleornil];
if (self) {//Custom initialization} return self;
  }-(void) viewdidload {[Super viewdidload];
  Do no additional setup after loading the view.
[Self initbackgroundview]; #pragma-mark-functions-(void) Initbackgroundview {//tableview scroll bar _scrolview=[[uiscrollview alloc]initwithframe:
  CGRectMake (0,19, 320, 460)];
  _scrolview.contentsize=cgsizemake (320*2, 460);
  _scrolview.delegate=self;
  _scrolview.pagingenabled=yes;
  _scrolview.showsverticalscrollindicator=no;
  _scrolview.bounces=no;
  [Self.view Addsubview:_scrolview];
  TableView1 _tableview =[[uitableview alloc]initwithframe:cgrectmake (0, 19, 320, 460)];
  _tableview.tag=1;
  _tableview.delegate=self;
  _tableview.datasource=self; _tableview. Scrollenabled=no;
  [_scrolview Addsubview:_tableview];
  TableView2 _tableview2=[[uitableview Alloc]initwithframe:cgrectmake (320, 19, 320, 460)];
  _tableview2.tag=2;
  _tableview2.delegate=self;
  _tableview2.datasource=self;
  _tableview2.scrollenabled=no;
[_scrolview Addsubview:_tableview2]; } #pragma-mark-uitableviewdelegate-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (NSInteger
  ) section {return 3;}-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) Indexpath {
return 125; }-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) IndexPath {_cell=[
  TableView dequeuereusablecellwithidentifier:@ "ID"];
  if (_cell==nil) {_cell=[[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseIdentifier:@ "ID"];
  } _cell.selectionstyle=uitableviewcellselectionstylenone;
   if (tableview.tag==1) {_cell.textlabel.text=@ "1"; }else if (tableview.tag==2) {_cell. textlabel.text=@ "2";
return _cell; }

The above content is a small part of the Android program to introduce the development of the Uiscrollerview has two TableView detailed introduction, I hope to help!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.