【问题标题】:Can anyone show me an example on how to add text to a UIScrollView?任何人都可以向我展示如何向 UIScrollView 添加文本的示例吗?
【发布时间】:2011-02-28 15:22:24
【问题描述】:

我见过的大多数代码示例都显示了添加的图像。我正在寻找一个基本上只显示大约 10-15 行数据被添加到 UIScrollVIew 的示例。

任何可靠的建议将不胜感激。

【问题讨论】:

    标签: iphone ios uiscrollview


    【解决方案1】:

    把这个放到:viewDidLoad{}

    //create UITextView
    
    UITextView *myUITextView = [[UITextView alloc] initWithFrame:CGRectMake(20,188,280,260)];
    myUITextView.text = infoText;
    myUITextView.textColor = [UIColor lightGrayColor];
    myUITextView.font = [UIFont systemFontOfSize:14];
    [myUITextView setBackgroundColor:[UIColor clearColor]];
    myUITextView.editable = NO;
    myUITextView.scrollEnabled = YES;
    [Scrollerview addSubview:myUITextView];
    [myUITextView release];
    

    'infoText' 是你的文本,'Scrollerview' 是你的 uiScrollView

    【讨论】:

      【解决方案2】:

      查看 UITextView,它相当容易实现,但它可能没有您想要的多功能性。 http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextView_Class/Reference/UITextView.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-12-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-06-01
        相关资源
        最近更新 更多