Snapkit: Inset and offset seem to behave inconsistently

Created on 27 Jul 2016  路  1Comment  路  Source: SnapKit/SnapKit

New Issue Checklist

| Info | Value |
| --- | --- |
| Platform | os x |
| Platform Version | 10.11 |
| SnapKit Version | 0.21.0 |
| Integration Method | carthage |

Issue Description

I can't seem to figure out how inset and offset are supposed to be used. It seems like depending on the constraint they act differently. Sorry I don't have exact examples right now, but in general I've had issues like:

  1. Inset and offset doing the same thing on some constraints, but the opposite on others
  2. Sometimes needing to use a negative number to get the expected behavior, sometimes not depending on constraint

My thinking was that inset moved things inside while offset moves things outside. But it seems like for some constraints like top IIRC, I have to use offset to move the view down, rather than inset, and other nonintuitive stuff like that.

Maybe I'm just thinking about them incorrectly? I don't see anything in the docs on how exactly they're meant to be used. Could you elaborate on them, and even better, add the info to the documentation? Thanks!

Most helpful comment

@einsteinx2 It is a bit confusing. To give you a bit of reference here:

  • offset is set as the constant value regardless of the attribute.
  • inset is set as the constant value, but sometimes inverted depending on the attribute. For instance right/bottom/width/height will be -(value)

If this isn't the case please provide an example with what isn't working this way and I'll get it tidied up.

>All comments

@einsteinx2 It is a bit confusing. To give you a bit of reference here:

  • offset is set as the constant value regardless of the attribute.
  • inset is set as the constant value, but sometimes inverted depending on the attribute. For instance right/bottom/width/height will be -(value)

If this isn't the case please provide an example with what isn't working this way and I'll get it tidied up.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Shehryar picture Shehryar  路  7Comments

NicholasTD07 picture NicholasTD07  路  8Comments

Cookiezby picture Cookiezby  路  8Comments

lolgear picture lolgear  路  5Comments

seljabali picture seljabali  路  3Comments