dugla
dugla

Reputation: 12954

UIView. What are the maximum bounds dimensions I can use?

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

Upvotes: 7

Views: 5988

Answers (3)

Brad Larson
Brad Larson

Reputation: 170317

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.

Upvotes: 9

Barry Hurley
Barry Hurley

Reputation: 577

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.

Upvotes: 0

Paul Franceus
Paul Franceus

Reputation: 420

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

Upvotes: 1

Related Questions