【发布时间】:2014-05-20 04:54:11
【问题描述】:
我有一个场景,我尝试实现但无济于事 - 将带有文本框的滚动视图放在页面控制器中。
这是我所做的 - UIPageViewController->ViewController with data ->UIView ->UIScrollView -> UITextView。
它有什么作用?好吧,除了滚动一点(不显示所有文本)并在底部显示一个奇怪的白条之外,什么都没有。
有用的sn-ps代码-基本上我链接了我的高度约束,然后在代码中:
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
//CGSize sizeThatShouldFitTheContent = [_textView sizeThatFits:_textView.frame.size];
self.theScrollView.frame = CGRectMake(self.theScrollView.frame.origin.x, self.theScrollView.frame.origin.y, 320, 2000);//[_theScrollView sizeThatFits:_theScrollView.frame.size];
_heightOfText.constant = 2000; //sizeThatShouldFitTheContent.height;
//_textView.frame = CGRectMake(_textView.frame.origin.x, _textView.frame.origin.y, sizeThatShouldFitTheContent.width, sizeThatShouldFitTheContent.height);
_textView.scrollEnabled = NO;
NSLog(NSStringFromCGRect(self.theScrollView.frame));
self.theScrollView.scrollEnabled = YES;
}
但是没有。
提前致谢
【问题讨论】:
-
你设置 contentSize 了吗?
-
AFAIK 在使用 iOS 7 和自动调整大小时不再有效?
-
尝试在滚动视图和文本视图之间放置一个视图。这会给滚动视图一些界限。
-
你的意思是滚动视图->视图->文本视图层次还是滚动视图->视图、文本视图层次?
标签: ios iphone objective-c uiscrollview