首页新闻找找看学习计划

在ScrollView上添加TableView点击不到Cell怎么解决,求各位大神帮帮忙 。在线等

0
[待解决问题]

    [superviewDidLoad];

    DetailsScrollView = [[UIScrollViewalloc]init];

    DetailsScrollView.backgroundColor = [UIColorwhiteColor];

    DetailsScrollView.accessibilityActivationPoint = CGPointMake(100, 100);

    DetailsScrollView.minimumZoomScale = 0.5;

    DetailsScrollView.maximumZoomScale = 3;

    DetailsScrollView.contentSize = CGSizeMake(0,2250);

    DetailsScrollView.delegate = self;

    [self.viewaddSubview:DetailsScrollView];

    DetailsScrollView.sd_layout

    .leftSpaceToView(self.view, 0)

    .topSpaceToView(self.view, 0)

    .widthIs(kScreenWidth)

    .heightIs(kScreenHeight);

 

    Titleview = [[TitleViewalloc]init];

    Titleview.backgroundColor = [UIColorwhiteColor];

    [DetailsScrollViewaddSubview:Titleview];

    Titleview.sd_layout

    .leftSpaceToView(DetailsScrollView, 0)

    .topSpaceToView(DetailsScrollView, 0)

    .widthIs(kScreenWidth)

    .heightIs(75);

    

    ImageView_FirstPicture = [[UIImageViewalloc]init];

    NSString *String_FirstPicture=[[NSBundlemainBundle]pathForResource:@"详情内容第一张图片"ofType:@"jpg"];

    UIImage *FirstPicture_image=[UIImageimageWithContentsOfFile:String_FirstPicture];

    ImageView_FirstPicture.layer.contents=(id)FirstPicture_image.CGImage;

    [DetailsScrollViewaddSubview:ImageView_FirstPicture];

    ImageView_FirstPicture.sd_layout

    .leftEqualToView(Titleview)

    .topSpaceToView(Titleview, 0)

    .widthIs(kScreenWidth)

    .heightRatioToView(Titleview, 3.5);

    

    ImageView_SecondPictures = [[UIImageViewalloc]init];

    NSString *String_SecondPictures=[[NSBundlemainBundle]pathForResource:@"详情内容第二张图片"ofType:@"jpg"];

    UIImage *SecondPictures_image=[UIImageimageWithContentsOfFile:String_SecondPictures];

    ImageView_SecondPictures.layer.contents=(id)SecondPictures_image.CGImage;

    [DetailsScrollViewaddSubview:ImageView_SecondPictures];

    ImageView_SecondPictures.sd_layout

    .leftEqualToView(ImageView_FirstPicture)

    .topSpaceToView(ImageView_FirstPicture, 0)

    .widthIs(kScreenWidth)

    .heightRatioToView(ImageView_FirstPicture, 2);

    

    ImageView_ThirdPictures = [[UIImageViewalloc]init];

    NSString *String_ThirdPictures=[[NSBundlemainBundle]pathForResource:@"详情内容第三张图片"ofType:@"jpg"];

    UIImage *ThirdPictures_image=[UIImageimageWithContentsOfFile:String_ThirdPictures];

    ImageView_ThirdPictures.layer.contents=(id)ThirdPictures_image.CGImage;

    [DetailsScrollViewaddSubview:ImageView_ThirdPictures];

    ImageView_ThirdPictures.sd_layout

    .leftEqualToView(ImageView_SecondPictures)

    .topSpaceToView(ImageView_SecondPictures, 0)

    .widthIs(kScreenWidth)

    .heightRatioToView(ImageView_FirstPicture, 2);

    

    Formatview = [[FormatViewalloc]init];

    Formatview.backgroundColor = [UIColorwhiteColor];

    [DetailsScrollViewaddSubview:Formatview];

    Formatview.sd_layout

    .leftEqualToView(Titleview)

    .topSpaceToView(ImageView_ThirdPictures, 0)

    .widthIs(kScreenWidth)

    .heightRatioToView(Titleview, 1);

 

    LineOne = [[UIViewalloc]init];

    LineOne.backgroundColor = [UIColorlightGrayColor];

    [DetailsScrollViewaddSubview:LineOne];

    LineOne.sd_layout

    .leftEqualToView(Formatview)

    .topSpaceToView(Formatview, 0)

    .widthRatioToView(Formatview, 1)

    .heightIs(2);

    

    DetailDataview = [[DetailDataViewalloc]init];

    DetailDataview.backgroundColor = [UIColorwhiteColor];

    [DetailsScrollViewaddSubview:DetailDataview];

    DetailDataview.sd_layout

    .leftEqualToView(Titleview)

    .topSpaceToView(LineOne, 0)

    .widthIs(kScreenWidth)

    .heightRatioToView(Titleview, 4.5);

    

    LineTwo = [[UIViewalloc]init];

    LineTwo.backgroundColor = [UIColorlightGrayColor];

    [DetailsScrollViewaddSubview:LineTwo];

    LineTwo.sd_layout

    .leftEqualToView(DetailDataview)

    .topSpaceToView(DetailDataview, 0)

    .widthRatioToView(LineOne, 1)

    .heightIs(2);

    

    SubTabelview = [[SubTabelViewalloc]init];

    

    [DetailsScrollViewaddSubview:SubTabelview];

    SubTabelview.sd_layout

    .topSpaceToView(LineTwo, 0)

    .widthRatioToView(LineTwo, 0)

    .heightIs(kScreenHeight);

    

//    [SubTabelview viewInit];

    

    [selfinitTable];

    [selfinitNSArray];

}

 

- (void)initTable{

    SubTabelview.ReviewFormTable.delegate=self;

    SubTabelview.ReviewFormTable.dataSource=self;

    //垂直滚动条状态

    SubTabelview.ReviewFormTable.showsVerticalScrollIndicator = YES;

    }

 

- (void)initNSArray{

    array_Image = @[[UIImageimageNamed:@"头像.png"],

                    [UIImageimageNamed:@"头像.png"],

                    [UIImageimageNamed:@"头像.png"],

                    [UIImageimageNamed:@"头像.png"],

                    [UIImageimageNamed:@"头像.png"],

                    [UIImageimageNamed:@"头像.png"]];

    

    array_Theme=@[@"重庆三峡大坝",

                  @"重庆三峡大坝",

                  @"重庆三峡大坝",

                  @"重庆三峡大坝",

                  @"重庆三峡大坝",

                  @"重庆三峡大坝"];

    

    

    array_Text=@[@"大家给北京人的福利就是打开",

                  @"大家给北京人的福利就是打开",

                  @"大家给北京人的福利就是打开",

                  @"大家给北京人的福利就是打开",

                  @"大家给北京人的福利就是打开",

                 @"大家给北京人的福利就是打开"];

 

    array_Tim = @[@"25分钟前",@"30分钟前",@"23分钟前",@"50分钟前",@"43分钟前",@"25分钟前"];

    

    array_Reply = @[@"回复",@"回复",@"回复",@"回复",@"回复",@"回复",];

}

 

-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{

    returnDetailsScrollView;

}

 

 

 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    returnarray_Image.count;

}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    

    return75;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    staticNSString *identifier = @"CELL";

    SubTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];

    

    if (!cell) {

        cell=[[SubTableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:identifier];

    }

//

//    SubTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];//根据indexPath准确地取出一行,而不是从cell重用队列中取出

//    if (cell == nil) {

//        cell = [[SubTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];    }

    

    

    //    [tableView setSeparatorColor:[UIColor redColor]];

    

    cell.ImageView_HeadPortrait.image=array_Image[indexPath.row];

    [cell.Button_ThemesetTitle:array_Theme[indexPath.row] forState:UIControlStateNormal];

    [cell.Button_ThemesetTitleColor:[UIColorblackColor] forState:UIControlStateNormal];

    [cell.Button_ThemeaddTarget:selfaction:@selector(myTheme:) forControlEvents:UIControlEventTouchUpInside];

    cell.Label_Tim.text = array_Tim [indexPath.row];

    cell.Label_Tit.text = array_Text[indexPath.row];

    [cell.Button_ReplysetTitle:array_Reply[indexPath.row] forState:UIControlStateNormal];

    [cell.Button_ReplysetTitleColor:[UIColorgrayColor] forState:UIControlStateNormal];

    [cell.Button_ReplyaddTarget:selfaction:@selector(myReply) forControlEvents:UIControlEventTouchDown];

    return cell;

}

 

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    NSLog(@"dfkldkf");

}

 

ZYD*V587的主页 ZYD*V587 | 菜鸟二级 | 园豆:202
提问于:2017-05-23 14:09
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册