Skip to content

Instantly share code, notes, and snippets.

bool isLidClosed(void)
{
bool isClosed = false;
io_registry_entry_t rootDomain;
mach_port_t masterPort;
CFTypeRef clamShellStateRef = NULL;
// Retrieve the IOKit's master port so a notification port can be created
IOReturn ioReturn = IOMasterPort(MACH_PORT_NULL, &masterPort);
@S2Ler
S2Ler / air-print.m
Last active May 13, 2016 05:18
air print from ios sdk 4.2
#import "AirPrintingViewController.h"
@implementation AirPrintingViewController
-(void)printItem {
NSString *path = [[NSBundle mainBundle] pathForResource:@"demo" ofType:@"png"];
NSData *dataFromPath = [NSData dataWithContentsOfFile:path];
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];