iPhone - UIVc中的UIScrollView不滚动 [英] iPhone - UIScrollView inside UIView not scrolling

查看:92
本文介绍了iPhone - UIVc中的UIScrollView不滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIView ,其中包含许多标签,按钮,textview。但是我想要滚动的 UIView 中有一部分。这就是我的笔尖的结构。

I have a UIView which contains lot of labels, buttons, textviews. But there is a certain part of that UIView that I want to make scrollable.Here is how the structure of my nib is.

-UIVIew
-UIImageView - backgroundImage
-UILabels
-UIButtons
-UIScrollView
-UITextViews

触摸事件是否已分配到其他地方?这是我在 viewDidLoad 中编写的scrollview代码。我只希望 UIScrollview 中的textview可以滚动

Are touch events getting assigned to somewhere else? Here is a code of my scrollview which I have written in viewDidLoad. I only want the textview inside UIScrollview to be scrollable

scrollView.delegate = self;    
[scrollView setCanCancelContentTouches:NO];
scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
scrollView.clipsToBounds = YES;
scrollView.scrollEnabled = YES;
scrollView.pagingEnabled = YES;
scrollView.autoresizesSubviews=YES;
[scrollView setContentMode:UIViewContentModeScaleAspectFit];
[scrollView addSubview:textview]; 

我有什么事吗?我的做法是对的吗?

Am I mising something? is my approach right?

谢谢和问候

推荐答案

scroll.contentSize = CGSizeMake(320,2700); //您可以根据您的要求使用contentize

scroll.contentSize= CGSizeMake(320,2700);// You can use contentsize according to your requirements

你已经把这里只有scrollview代码。所以,我无法弄清楚出了什么问题。使用以下参考...

You have put here only scrollview code. So,I can't figure out what is wrong. Use following reference...

UIScrollView With UITextField

希望,这对你有帮助..

Hope, this will help you..

这篇关于iPhone - UIVc中的UIScrollView不滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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