UIView. What are the maximum bounds dimensions I c

2020-02-12 06:56发布

Does anyone happen to know the maximum value for someView.bounds.size ? I'm creating a view hierarchy with where the accumulated bounding-box of all child views is equal to the root parent view.

Cheers, Doug

标签: iphone uiview
3条回答
姐就是有狂的资本
2楼-- · 2020-02-12 07:35

I don't know that there's a specific limit. I have created UIScrollViews that are hundreds of pages in width without any problem. Have you tried it and run into problems?

Paul

查看更多
forever°为你锁心
3楼-- · 2020-02-12 07:37

According to the UIView documentation:

Prior to iPhone OS 3.0, UIView instances may have a maximum height and width of 1024 x 1024. In iPhone OS 3.0 and later, views are no longer restricted to this maximum size but are still limited by the amount of memory they consume. Therefore, it is in your best interests to keep view sizes as small as possible. Regardless of which version of iPhone OS is running, you should consider using a CATiledLayer object if you need to create views larger than 1024 x 1024 in size.

In actuality, I was able to create UIViews and CALayers that were 2048 x 2048 in size on a standard iPhone / iPhone 3G in 2.x. Anything above that just stopped rendering.

查看更多
兄弟一词,经得起流年.
4楼-- · 2020-02-12 07:38

I would not think there is a conceivable limit. Since the sizes are stored as floats, my guess would be that it is limited to CGFLOAT_MAX which is so large there is no need to worry about it.

查看更多
登录 后发表回答