IOS: view. Frame

Source: Internet
Author: User

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

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.