我以编程方式创建了UITableView,并发现它不滚动。这是我第一次以编程方式创建UITableView,而不是通过Interface Builder。是否有一些属性,我需要设置编程,使我的视图滚动?我已经尝试setBounces,setScrollEnabled,setAlwaysBounceVertical,但似乎没有工作。任何想法将不胜感激!谢谢!UITableView不滚动(iOS)
示例代码:
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];
你能发表你的代码样本吗? – Matt
添加了代码示例... – user1118042
您的UITableView中是否有足够的内容需要滚动? –