ios - UIScrollView 做空白并且不滚动

标签 ios iphone objective-c uiscrollview

我有一个场景,我试图实现但无济于事 - 放置一个带有文本框的 ScrollView ,所有这些都在页面 Controller 中。

这是我所做的 - UIPageViewController->ViewController with data -> UIView -> UIScrollView -> UITextView。

它能做什么?好吧,除了滚动一点(不显示所有文本)并在底部显示一个奇怪的白条之外,什么都没有。

有用的代码片段 - 基本上我链接了我的高度约束,然后在代码中:

- (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;
}

但是没有。

提前致谢

最佳答案

这解决了我的问题 - 显然我应该调用一个选择器......

-(void)viewDidLoad
{
// Change the size of page view controller
    self.pageViewController.view.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height + 40);
    [self performSelector:@selector(adjustScrollViewContentSize) withObject:nil afterDelay:0.1];
}

-(void)adjustScrollViewContentSize
{
    _scrollView.contentSize = CGSizeMake(4000, 4000);
}

关于ios - UIScrollView 做空白并且不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22921028/

相关文章:

ios - UITableViewDelegate : reduce repeated code by adding default implementations, 有什么更好的主意吗?

objective-c - 如何在 Objective-C 中进行矩阵和向量数学运算?

iphone - AVMutableComposition 视频创建问题

iphone - @2x.png 也需要非@2x.png 大小?

iphone - 在我的 IOS 应用程序中集成 Tumblr API

ios - Music TrackSetDestNode 重置旧音乐轨道的采样器声音

ios - 使用ios 64bit架构的Zlib解压方法警告

ios - 收入猫-老用户的祖父

ios - Swift:使用带有多个参数的选择器

ios - 如何从播放列表中获取 EXT-X-PROGRAM-DATE-TIME