Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用分组的模式显示问题 #225

Open
fanlilinSaber opened this issue Jun 1, 2023 · 3 comments
Open

用分组的模式显示问题 #225

fanlilinSaber opened this issue Jun 1, 2023 · 3 comments

Comments

@fanlilinSaber
Copy link

希望能默认显示出UITableView的自定义(headerView 和 footerView)作为分割线
类似下面这种代码

  • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return dataArray.count;
    }

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

  • (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 10;
    }

  • (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 20;
    }

  • (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UITableViewHeaderFooterView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"headerView"];
    if (headerView == nil) {
    headerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:@"headerView"];
    headerView.contentView.backgroundColor = UIColor.redColor;
    }
    return headerView;
    }

  • (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UITableViewHeaderFooterView *footerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"footerView"];
    if (footerView == nil) {
    footerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:@"footerView"];
    footerView.contentView.backgroundColor = UIColor.yellowColor;
    }
    return footerView;
    }

@tigerAndBull
Copy link
Owner

默认是默认到什么程度。只要给足组件你想要的信息就可以显示的。
这里需要固定section,否则组件也不知道你希望有几个分区。

@fanlilinSaber
Copy link
Author

好的 我知道了 谢谢

@fanlilinSaber
Copy link
Author

能支持一下传入外部的 UIImage吗,因为传入 placeholderName 如果这个图片是在其他组件里面,访问到这个图片必须以 inBundle:resourceBundle 方式才能访问到

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants