gpt4 book ai didi

ios - 更改标题 View iOS

转载 作者:行者123 更新时间:2023-11-28 23:10:09 26 4
gpt4 key购买 nike

我四处寻找答案并想出了这段代码。我正在尝试将图片插入标题 View (通常是单词)。

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

{

UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 90.0)];

UIImageView *i=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMAGE NAME"]];

[customView addSubview:i];

return customView;

}

表格 View 标题保持空白。

有什么想法吗?我才刚刚开始...谢谢!

最佳答案

这非常适合我:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 90;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIImageView *i = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMAGE NAME"]];
i.frame = CGRectMake(0.0, 0.0, 320.0, 90.0);
return [customView autorelease];
}

关于ios - 更改标题 View iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8484598/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com