无法使文本视图滚动 - xcode 4.3 [英] cannot make a text view scroll - xcode 4.3

查看:59
本文介绍了无法使文本视图滚动 - xcode 4.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Xcode 4.3

I am using Xcode 4.3

我有一个具有文本视图 UITextView 的单个屏幕,我希望能够垂直滚动.

I have a single screen that has a text view UITextView that I wish to be able to scroll just vertically.

我在屏幕上添加了一个滚动UIScrollview 和一个UITextview.我创建了一个名为 theScroller 的新插座,并在 viewcontroller.m 文件中添加了该行.

I have added a scroll to the screen UIScrollview and a UITextview on top of that. I have created a new outlet called theScroller and in the viewcontroller.m file added the line.

(void)viewdidLoad 
{
self.thescroller.contentSize=CGSizeMake(280.0,600.0);

但是在我看过的大多数教程中,它们都在此之前添加了一行以将 scroller 设置为 YES,但在 Xcode 4.3 中它不会让我这样做.如何打开滚动条.我做错了什么.?

However in most tutorials I have watched, they all add a line before this to set scroller to YES, but in Xcode 4.3 it wont let me. How do I turn the scroller on. what am I doing wrong.?

我是新手,所以请保持简单.谢谢

I am a newbie at this so please keep things simple. thanks

推荐答案

首先,UITextView 的内容是否大于 UITextView 的视图尺寸?如果它更大,那么它会滚动,如果不是,那么它不会滚动.

Firstly, is the content of the UITextView larger than the view dimensions for the UITextView? If it is larger, then it will scroll, if not, then it won't scroll.

使用 UITextView 你不需要额外的 UIScrollView 来滚动.

And with the UITextView you don't need an additional UIScrollView for it to scroll.

您已添加 contentSize 代码,但是,如果您的文本不大于正常视图大小,则 UITextView 不会滚动.UITextView 会在任何文本超出尺寸时自动允许滚动.尝试添加比查看更多的文本,然后查看它是否会滚动.

You've added the contentSize code, however, the UITextView won't scroll if your text isn't larger than the normal view size. UITextView's automatically allow scroll if any text overflows from the size. Try adding a lot more text than will view, and see if it scrolls then.

这篇关于无法使文本视图滚动 - xcode 4.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆