SundayMonday
SundayMonday

Reputation: 19737

Debugging subtle iOS view layout issues

Lately I've been running into some subtle layout issues in my iOS app. For example displaying a viewController from one part of the app causes the layout of some subviews to be altered (the z-axis ordering changes). Another subtle issue is the navigation bar flickering slightly.

What are some techniques for debugging these issues?

I'm especially interested in printing/logging properties of objects. For example I'd like to just dump/print/log all properties of the viewController referenced above to see exactly what changes. Then perhaps one can use symbolic breakpoints to pin-point the cause.

Upvotes: 1

Views: 326

Answers (4)

Zia
Zia

Reputation: 270

Use iOS App layout Debugging tool revealapp.com Just integrate revealapp SDK in your app and work as firebug

Upvotes: 1

Josh Buchacher
Josh Buchacher

Reputation: 95

Check out DCIntrospect. It's a tool that can be very helpful for looking at view's info conveniently.

Upvotes: 2

Another technique to use is to subclass a UIView with override methods for re-positioning a view, or other aspects - then you can set breakpoints or log when the frame changes, or other attributes.

To use the UIView debugging class you can just change the type of a View in InterfaceBuilder to be your custom view type instead of UIView.

Upvotes: 1

mvds
mvds

Reputation: 47104

You can use KVO to observe frames changing, so you know what changes when, from and to what values. You can even use it to fix properties to some contant value. (See Prevent indentation of UITableViewCell (contentView) while editing)

You can use reflection to loop through all properties of an object. I don't know how such a broad approach would help you, but it is possible. (See Loop through all object properties at runtime)

Upvotes: 1

Related Questions