UIButton * btn = [UIButton new];
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    //May god have mercy of me
    [[btn titleLabel] setFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium]];
    [btn setTitle:[NSString stringWithFormat:@"  %@  ", btnTxt] forState:UIControlStateNormal];
    [btn sizeToFit];
    [btn setTitle:btnTxt forState:UIControlStateNormal];

Why keep playing with label padding or insets when you can add spaces?

By Shy developer, 2017-12-12 14:32:37
static NSInteger const CBBIndexOne =  1;
static NSInteger const CBBIndexTwo =  2;
static NSInteger const CBBIndexThree =  3;
static NSInteger const CBBIndexFour =  4;
static NSInteger const CBBIndexSix =  6;
static NSInteger const CBBIndexSeven =  7;
static NSInteger const CBBIndexEight =  8;

static NSInteger const CBBRowHeightFifty =  50;
static NSInteger const CBBRowHeightSixtySix =  66;
static NSInteger const CBBRowHeightSixtyTwo =  62;
static NSInteger const CBBRowHeightOneTen =  110;
static NSInteger const CBBRowHeightOneEightEight =  188;
static NSInteger const CBBRowHeightTwoHundred =  200;
static NSInteger const CBBRowHeightThirtySix =  36;
By sulthan, 2019-08-15 10:55:57
int w = 100;

for (nil; w!=0; nil) {

    w -= 1;

    //so some shit
}

this code was found in chinese contract work

By JeanetteMueller, 2021-03-08 11:58:39
typedef NS_ENUM(NSUInteger, MyEnum1) {
    PackagesNo1 = 1,
    PackagesNo2 = 2,
    PackagesNo4 = 4,
    PackagesNo8 = 8
};

typedef NS_ENUM(NSUInteger, MyEnum2) {
    LEVEL0 = 0,
    LEVEL1 = 1,
    LEVEL2 = 2,
    LEVEL3 = 3
};

- (int)packagesNeededForLevel:(int)level {
    switch (level) {
        case LEVEL0:
            return PackagesNo8;
        case LEVEL1:
            return PackagesNo4;
        case LEVEL2:
            return PackagesNo2;
        case LEVEL3:
            return PackagesNo1;
    }
}

well done mr junior

By Anonymous, 2021-04-12 09:37:34