简体   繁体   中英

iOS : How to make a CGRect as visible rect for UIView?

I am drawing a line graph in UIView for the width of 1200pixels. But I can visible only up to 320pixels. How can I make a rectangle starting from x=880 and width = 320 as visible?.

You can draw graph at 880px using following way.

Step 1 : Take UIScrollView with width = 1200 .

Step 2 : Add UIView in UIScrollView having X position = 880 and width = 320;

now you can draw graph on UIView . you received output same as you want.

Hope this help you.

The answer is not clear, but I guess that your problem is how to fully visualize a view that is clipped by the limit of the screen size.
There is a property on UIView to do that and is called -transform , using that you can scale your view until it fits, but pointing the usability factor I think that it would be useless.
There is a special view called UIScrollView , its purpouse is to display bigger views and navigate them by panning whith your fingers or zoom in/out just using a pich gesture.
I this way you can make the user explore your graph data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM