Skip to content

单独使用WMZPageView + 使用UIView作为底部视图 悬停效果 ,view内的滚动视图上下滚动会影响 总体滚动 #120

Description

@Lpkiki

需要加入 在VC中加入 [self.pageView performSelector:@selector(scrollViewDidScroll:) withObject:scrollView]; 解决问题(参考的WMZPageController)

大佬是不是我用的不对 ,你看下代码

`- (void)viewDidLoad {
[super viewDidLoad];

WMZPageParam *param = PageParam()
.wMenuHeadViewSet(^UIView *{
    UIImageView *image = [UIImageView new];
    [image sd_setImageWithURL:[NSURL URLWithString:@"https://upload-images.jianshu.io/upload_images/9163368-02e26751674a3bc6.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240"]];
    image.frame = CGRectMake(0, 0, PageVCWidth, 300);
    return image;
})


.wTitleArrSet(@[@"精选",@"好货",@"精选",@"好货"])
.wViewControllerSet(^UIViewController * _Nullable(NSInteger index) {

// return NSClassFromString(@"TopSuspensionVC").new;
/// 带滚动视图需实现协议
TopSuspensionView *view = TopSuspensionView.new;

    view.page = index;
    /// 这里为了方便使用 使用同一个属性 所以这里为了去除警告强转一下类型 但是实际类型还是UIView
    return (UIViewController*)view;
})


.wTopSuspensionSet(YES)

// .wMenuHeightSet(50)

// .wTopSuspensionSet(YES)
// //No为从自定义导航栏顶部开始 yes为从自定义导航栏底部开始
// // .wFromNaviSet(NO)
// //顶部可下拉
// // .wBouncesSet(NO)

;

/// frame可以设置任意frame autoFix为YES
self.pageView = [[WMZPageView alloc]initWithFrame:CGRectMake(0, 100, self.view.bounds.size.width, self.view.bounds.size.height - 200) autoFix:NO param:param parentReponder:self];
self.pageView.downSc.dataSource = self ;
self.pageView.downSc.delegate = self ;
[self.view addSubview:self.pageView];


param.wEventClickSet(^(id  _Nullable anyID, NSInteger index) {
    NSLog(@"%@ %ld",self.pageView.upSc.currentVC,self.pageView.upSc.currentTitleIndex);
});


/// autoFix为NO 自己调整frame

// WMZPageView *pageView = [[WMZPageView alloc]initWithFrame:CGRectMake(0, 0, PageVCWidth, PageVCHeight - PageVCNavBarHeight) autoFix:NO param:param parentReponder:self];
// [self.view addSubview:pageView];
}

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = @"自定义视图";
    cell.detailTextLabel.text = @"自定义cell";
    return cell;
    }

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

    return 100;
    }

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
    }

//注释这段代码会出现 滚动冲突

  • (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    [self.pageView performSelector:@selector(scrollViewDidScroll:) withObject:scrollView];
    }

`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions