Skip to content

Instantly share code, notes, and snippets.

@danie7k
danie7k / snapshot.m
Last active January 15, 2022 02:18
iOS Objective-C screenshot
- (UIImage *)snapshot:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
--- CCDevice.mm (revision 6)
+++ CCDevice.mm (working copy)
@@ -102,11 +102,12 @@
- (void)accelerometer:(CMAccelerometerData *)accelerometerData
{
- _acceleration->x = accelerometerData.acceleration.x;
- _acceleration->y = accelerometerData.acceleration.y;
- _acceleration->z = accelerometerData.acceleration.z;
- _acceleration->timestamp = accelerometerData.timestamp;
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active July 26, 2024 10:00
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S