Iphone 滚动don';无法在UIImageView中包含的UITextView中工作
我有一个简单的应用程序,在UIImageView中包含的“小”UITextView中有一个“大”文本。 我无法滚动到我的文本,我不明白为什么? 如果没有UIImageView,则可以使用滚动Iphone 滚动don';无法在UIImageView中包含的UITextView中工作,iphone,scroll,uiimageview,uitextview,Iphone,Scroll,Uiimageview,Uitextview,我有一个简单的应用程序,在UIImageView中包含的“小”UITextView中有一个“大”文本。 我无法滚动到我的文本,我不明白为什么? 如果没有UIImageView,则可以使用滚动 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIImage *backImg = [UIImage imageName
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIImage *backImg = [UIImage imageNamed:@"infoScreen.png"];
UIImageView *background = [[UIImageView alloc] initWithImage:backImg];
UITextView *textview = [[UITextView alloc] initWithFrame:CGRectMake(45, 145, 230, 200)];
textview.text = @"Lorem ipsum dolor [...] deserunt mollit anim id est laborum.";
[background addSubview:textview];
[textview release];
[window addSubview:background];
[background release];
[window makeKeyAndVisible];
return YES;}
谢谢。UIImageView默认情况下已将
userInteractionEnabled
设置为否,因此滚动或任何交互在默认情况下不会作为UIImageView的子视图工作
将userInteractionEnabled
设置为是,然后重试
正确的方法是创建一个包含背景图像和文本视图的UIView
UIView* container = ...
...
[container addSubview:background]; [background release];
[container addSubview:textview]; [textview release];
[window addSubview:container]; [container release];
默认情况下,UIImageView的
userInteractionEnabled
设置为否,因此滚动或任何交互在默认情况下都不会作为UIImageView的子视图工作
将userInteractionEnabled
设置为是,然后重试
正确的方法是创建一个包含背景图像和文本视图的UIView
UIView* container = ...
...
[container addSubview:background]; [background release];
[container addSubview:textview]; [textview release];
[window addSubview:container]; [container release];