jas bath
jas bath

Reputation: 63

Height for UIViewControllers don't go beyond 10,000

I am making something that is longer than 10,000 height for a ScrollView and ViewController. I've made it 10,000 but when I go beyond 10,000 it gives an error, is there a way to go beyond 10,000?

I have used many apps that go beyond the number 10,000 but when I try to create something beyond 10,000 it would give me an error saying

"Interface Builder does not support UIView sizes larger than 10,000 by 10,000."

This would help me a lot, if it would be possible, but I have seen a lot of apps that have a scrollView longer than 10,000. Need help!

screenshot

screenshot

screenshot

Upvotes: 1

Views: 2779

Answers (3)

kikettas
kikettas

Reputation: 1742

After this annoying bug appeared in my project, I've been finally able to fix it following these steps: (I had three views with a height of 24.142.523, one within another)

  • First, I set a height constraint of 30 for the three views (starting from the more nested).
  • Second I remove that constraints in the reverse order.

After this all "Interface Builder does not support UIView sizes larger than 10,000 by 10,000." errors disappeared.

Regards!

EDIT:

I've just noticed a weird thing. If I try to put a label with no text within a Stackview it sets a size of thousands, however if I set a text with a white space or a random string it works fine.

Upvotes: 7

Kjuly
Kjuly

Reputation: 35171

If you want to make a big subview that contained in scrollView, like a map, you'd better to do it programmatically, and better to split your 10000 size map into smaller pieces like 512 x 512, while user scrolling the map, load each piece lazily.

(And if you persist to do it in one view, you can do it as you like programmatically w/o that warning, though it's not recommended.)


But if you want to make the scrollview large enough to contain sth else, then you'r in wrong direction to solve the problem, you should modify scrollView's contentSize instead of frame:

[yourScrollView setContentSize:CGSizeMake(10000.f, 10000.f)];

Upvotes: 0

Sohel L.
Sohel L.

Reputation: 9540

I don't know why you want to make 'UIScrollView' so big? I hope it's because of settings the elements in the UIScrollView.

Do the following things to solve:

  1. Make UIScrollView as long as you have to! (Ignore error)
  2. Set all you your elements in it.
  3. Once all is done, resize the UIScrollView to fit into UIStoryBoard or under the specific area in which you need to display UIScrollView.

Hope this helps!

Upvotes: 0

Related Questions