我们试图为RSS类应用程序实现文章详细视图。窗口有一个UIScrollView,它包含一个UITextView(它是标题),一个UIButton(它将打开一个图库)和一个UIWebView(与正文一起)。这个想法是,所有这些元素一起滚动...将各种视图插入UIScrollView
问题是,只要我们有超过1000px高的身体,该标记下的所有内容都会被截断。我们已经听说这是因为这是视图的最大高度,并且由于Scroll由顶层的UIScrollView处理,所以没有办法看到进一步下降的情况。
有没有人知道解决这个问题的方法?
谢谢!
----更新1 ----
我们已经打破了体内转化为900px,高块,但第一个毕竟网页视图显示任何内容...
UIScrollView *scroll=[[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[scroll setBackgroundColor:[UIColor whiteColor]];
[scroll setCanCancelContentTouches:NO];
scroll.clipsToBounds = NO;
scroll.indicatorStyle = UIScrollViewIndicatorStyleBlack;
//Título
CGRect tit =CGRectMake(5.0f, 0.0f, 315.f, 50.0f);
UILabel *titulo=[[UILabel alloc] initWithFrame:tit];
titulo.text=[itemNew objectForKey:@"titulo"];
titulo.numberOfLines = 2;
titulo.font=[UIFont fontWithName:@"Helvetica" size:16.0f];
titulo.textColor=[self getColor:@"00336E"];
[scroll addSubview:titulo];
[titulo release];
//Entradilla
float altura_entradilla=calcLabel([itemNew objectForKey:@"entradilla"], [UIFont boldSystemFontOfSize:16], 50, 315.0f);
CGRect ent_frame = CGRectMake(5.0f, 50.0f, 315.0f,altura_entradilla);
UILabel *entradilla=[[UILabel alloc] initWithFrame:ent_frame];
entradilla.text=[itemNew objectForKey:@"entradilla"];
entradilla.numberOfLines=4;
entradilla.font=[UIFont fontWithName:@"Helvetica" size:17.0f];
entradilla.textColor=[UIColor blackColor];
[scroll addSubview:entradilla];
[entradilla release];
NSString *cuerpo=[itemNew objectForKey:@"cuerpo"];
[scroll setContentSize:CGSizeMake(320.0f,40000.0f)];
[scroll setScrollEnabled:YES];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(5.0f, altura_entradilla+50, 315.0f, 900)];
[webView loadHTMLString:cuerpo baseURL: [NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath]]];
webView.detectsPhoneNumbers=NO;
webView.delegate=self;
[webView setScalesPageToFit:NO];
[scroll addSubview:webView];
webView.backgroundColor=[UIColor blackColor];
webView.userInteractionEnabled=NO;
[webView release];
if (altura_webview>900) {
UIWebView *webView2 = [[UIWebView alloc] initWithFrame:CGRectMake(5.0f, altura_entradilla+50+900, 315.0f, 900)];
[webView2 loadHTMLString:cuerpo baseURL: [NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath]]];
webView2.detectsPhoneNumbers=NO;
webView2.delegate=self;
[webView2 setScalesPageToFit:NO];
[scroll addSubview:webView2];
webView2.backgroundColor=[UIColor yellowColor];
webView2.userInteractionEnabled=NO;
[webView2 release];
}
self.view=scroll;
我不知道这是否会工作,但是可以将UIText和UIButton插入到UIWebView中吗? – Antonio 2009-04-21 16:16:20
WebView具有webView.userInteractionEnabled = YES;这样所有的视图都可以通过UIScrollView一起滚动。 – Antonio 2009-04-22 10:45:49