Selecting Camera //********** GET CAMERA IN SPECIFIED POSITION IF IT EXISTS ********** – (AVCaptureDevice *) CameraWithPosition:(AVCaptureDevicePosition) Position { NSArray *Devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; for (AVCaptureDevice *Device in Devices) { if ([Device position] == Position) { return Device; } } return nil; } //Then to use a specific camera: [self CameraWithPosition:AVCaptureDevicePositionFront] [self CameraWithPosition:AVCaptureDevicePositionBack] Does Device Have […]
All posts by
Z order
Bringing Objects To Front And Sending To Back Remember that UI objects such as buttons etc are all actually subviews [self.view bringSubviewToFront:MyButton]; [self.view sendSubviewToBack:MyButton]; Layers MyView.layer.zPosition = 1; //1 = front
Camera As A Subview
Good Resources http://stackoverflow.com/questions/5915943/use-camera-as-subview
Camera Preview On A View Controller
This is based on the superb example here: http://red-glasses.com/index.php/tutorials/ios4-take-photos-with-live-video-preview-using-avfoundation/ Adding Live Preview NOTE – this works for portrait. There seems to currently be an issue making this work with Landscape due to the apple API lacking the required orientation setting Define in the .h file @interface MyViewController : UIViewController { IBOutlet UIView *vImagePreview; //<<<<<ADD THIS […]
Overlaying Controls On Camera View
Good resources http://www.musicalgeometry.com/?p=1273
Displaying Values In Strings
Boolean [NSString stringWithFormat:@”The value is: %d”, MyBool] Char [NSString stringWithFormat:@”The value is: %c”, MyChar] Decimal [NSString stringWithFormat:@”The value is: %d”, MyInt] [NSString stringWithFormat:@”The value is: %06d”, MyInt] //Display as 6 digits with leading zeros as necessary Unsigned Long [NSString stringWithFormat:@”The value is: %lu”, MyUnsignedLong] Long [NSString stringWithFormat:@”The value is: %ld”, MyLong] Long Long [NSString stringWithFormat:@”The […]
Disk Information
Getting Free Disk Space Based on the example at http://iphoneincubator.com/blog/device-information/how-to-obtain-total-and-available-disk-space-on-your-iphone-or-ipod-touch //***************************************** //***************************************** //********** GET FREE DISK SPACE ********** //***************************************** //***************************************** -(float)GetFreeDiskSpaceInBytes { float totalSpace = 0.0f; NSError *error = nil; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error]; if (dictionary) { NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemFreeSize]; //Or […]
Transfering Files Via iTunes
Using iTunes and the USB cable can provide MUCH faster file transfers thn WiFi. To enable set IFileSharingEnabled key to true in Info.plist (note it is not a string) The file share directory When file sharing is enabled, the entire Documents folder is used for file sharing. Files that that are not intended for user […]
Get Battery State
Turn on battery monitoring for your app [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; Getting The Current State //—– DISPLAY BATTERY STATE —– if ([[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateUnknown) { [BatteryStateLabel setText:@””]; } else { NSString *BatteryString = [NSString stringWithFormat:@”Battery: %0.0f%%”, [[UIDevice currentDevice] batteryLevel] * 100]; switch ([[UIDevice currentDevice] batteryState]) { case 1: //Battery is in use (discharging) break; […]
System Alerts
System Alerts Calling Methods System alerts, such as “Low battery, 20% of battery remaining” will call the following methods: applicationWillResignActive called before the alert comes up applicationDidBecomeActive called after the alert is dismissed A typical problem is if you use applicationDidBecomeActive to detect your app starting up from a suspended state (from multitasking). To solve this […]