We know that view. frame is in the coordinate space of the parent container of the current view. I put only one view in one viewcontroller on the iPad, and only one webview (interface landscape) is included in the view. I wanted to reach the contentsize of webview, so ICodeAdd:
View code
Nslog (@"Self. View. frame is % @", Nsstringfromcgrect (self. View. Frame); nslog (@"Self. webview. frame is % @", Nsstringfromcgrect (self. webview. Frame); nslog (@"Webview. scrollview. contentsize is % @", Nsstringfromcgsize (webview. scrollview. contentsize); nslog (@"Webview. scrollview. frame is % @", Nsstringfromcgsize (webview. scrollview. Frame. Size ));
However, the output is:
Self. View. frame is {0, 20}, {768,100 4 }}
Self. webview. frame is {0, 0}, {768,100 4 }}
Webview. scrollview. contentsize is {1024,100 4}
Webview. scrollview. Frame. size is {100,100}
It is totally different from the logic.
Originally, I put the above Code in viewdidload. After playing the view in nib or storyboard in the system value, I immediately called viewdidload. At this time, the system did not load the content in it, I still don't know the direction or anything.
After I put the code in the loaded place, the correct ones should be:
Self. View. frame is {20, 0}, {748,102 4 }}
Self. webview. frame is {0, 0 },{ 1024,748 }}
Webview. scrollview. contentsize is {5944,748}
Webview. scrollview. Frame. size is {1024,748}
Note that the coordinate system of the uiwindow has always been erected.
Check more: http://stackoverflow.com/questions/9539676/uiviewcontroller-returns-invalid-frame