2

質問があります。埋め込み View >Xcodeがあり、 Scrollviewの内部には UIWebView があります。ViewControllerScrollView

アプリケーションは、いくつかの XML データを読み取り、書式設定されたテキストを に貼り付けますUIWebView。の後UIWebView-Elementは別の要素なので、UIWebView動的に高さを調整する必要があります。

ビューを読み込んだ後はすべて問題ありませんが、画面をタップすると、ビューのサイズがscrollviewストーリーボードの高さに変更されます。

なんで ?

- (void)webViewDidFinishLoad:(UIWebView *)aWebView
{
aWebView.scrollView.scrollEnabled = NO;    // Property available in iOS 5.0 and later
CGRect frame = aWebView.frame;

frame.size.width = 280;       // Your desired width here.
frame.size.height = 1;        // Set the height to a small one.

aWebView.frame = frame;       // Set webView's Frame, forcing the Layout of its embedded     scrollView with current Frame's constraints (Width set above).

frame.size.height = aWebView.scrollView.contentSize.height;  // Get the corresponding         height from the webView's embedded scrollView.

aWebView.frame = frame;       // Set the scrollView contentHeight back to the frame itself.

NSLog(@"size: %f, %f", aWebView.frame.size.width, aWebView.frame.size.height);

// Position URL Label
CGRect frame_label = fachmesseDetailWebsite.frame;
NSLog(@"x: %f", frame_label.origin.x);
NSLog(@"y: %f", frame_label.origin.y);
frame_label.origin.y=aWebView.frame.size.height+115;//pass the cordinate which you want
frame_label.origin.x= 20;//pass the cordinate which you want
fachmesseDetailWebsite.frame= frame_label;
NSLog(@"x: %f", frame_label.origin.x);
NSLog(@"y: %f", frame_label.origin.y);

}
4

1 に答える 1