gpt4 book ai didi

ios - UITableView 不滚动 (iOS)

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:51:25 27 4
gpt4 key购买 nike

我以编程方式创建了一个 UITableView,但发现它不滚动。这是我第一次以编程方式创建 UITableView,而不是通过 Interface Builder。是否需要以编程方式设置某些属性以使我的 View 能够滚动?我尝试了 setBounces、setScrollEnabled、setAlwaysBounceVertical,但似乎没有任何效果。任何想法将不胜感激!谢谢!

示例代码:

UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
CGFloat height = (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) ? 460 : 300;
feed = [[UITableView alloc] initWithFrame:CGRectMake(0.0f, 44.0f, self.bounds.size.width, height - 44.0f)];
[feed setSeparatorColor:[UIColor colorWithRed:38.0f/255.0f green:43.0f/255.0f blue:63.0f/255.0f alpha:1.0f]];
[feed setBackgroundColor:[UIColor colorWithRed:48.0f/255.0f green:53.0f/255.0f blue:73.0f/255.0f alpha:1.0f]];
[feed setDataSource:self];
[feed setDelegate:self];
[feed setHidden:YES];
[feed setBounces:YES];
[feed setScrollEnabled:YES];
[feed setAlwaysBounceVertical:YES];
[feed setDelaysContentTouches:YES];
[self addSubview:feed];

最佳答案

尝试在 TableView 上设置 delaysContentTouches。

关于ios - UITableView 不滚动 (iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10609416/

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