Quickies

[categories] [index] [all (531)] [latest]

Cocoa UIKit
  1. #if TARGET_OS_IPHONE
    #import <UIKit/UIKit.h>
    #else
        @compatibility_alias UIColor NSColor;
    #endif
    
  2. [[NSUserDefaults standardUserDefaults] setObject:@YES forKey:@"UIUseLegacyUI"]
    

    https://twitter.com/stroughtonsmith/status/384679231730761728

  3. - (UIImage *)image {
        UIGraphicsBeginImageContext(self.frame.size);
        [self.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return img;
    }
    
  4. - (void)applicationDidFinishLaunching:(UIApplication *)application {
        application.statusBarHidden = YES;
        // ...
    }
    
  5. [UIApplication sharedApplication].idleTimerDisabled = YES;
    
  6. #ifdef DEBUG
    [NSTimer scheduledTimerWithTimeInterval:1.0
                                     target:application
                                   selector:@selector(_performMemoryWarning)
                                   userInfo:nil
                                    repeats:YES];
    #endif
    
  7. po [UIView recursiveDescription]
    

    results:

    <UIView: 0x4b4d3d0; frame = (0 20; 320 460); (...)
       | <MyView: 0x4b4b800; frame = (20 20; 237 243); (...)
       |    | <UIRoundedRectButton: 0x4b4e790; (...)
       |    |   | <UIButtonLabel: 0x4b4f190; (...)