josh
josh

Reputation: 75

Changing view frame size

Working on https://github.com/madebybright/Nimble/

Trying to change the view frame size when the query function is run, but I keep getting

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.

when the query function runs.

When assigning the size in viewDidLoad everything works fine, but in query (https://github.com/madebybright/Nimble/blob/unstable/Nimble/MenuViewController.swift#L43) the error is thrown.

Any idea why?

Upvotes: 0

Views: 50

Answers (1)

jtbandes
jtbandes

Reputation: 118781

Yes. It's because

This application is modifying the autolayout engine from a background thread.

:)

To be more specific, you must do all UI-related work on the main thread. You can use dispatch_async to enqueue a task (such as your frame-size adjustment) on the main thread.

Upvotes: 1

Related Questions