Sunday, 12 June 2016

How to send email in swift

import foundation
import socail
import messaging
let mailComposerVC = MFMailComposeViewController()

mailComposerVC.mailComposeDelegate = self // Extremely important to set the --

mailComposeDelegate-- property, NOT the --delegate--
mailComposerVC.setToRecipients(["someone@somewhere.com"])

mailComposerVC.setSubject("Sending you an in-app e-mail...")

mailComposerVC.setMessageBody("Sending e-mail in-app is not so bad!", isHTML: false) just copy pase this code in button action and and check out put

Saturday, 2 April 2016

How to ON/OFF flashlight with one button in iOS

led flash in ios

some easy way to use led flash light for your project code

so what you need to this?? which framework you need to do this?



you have to import AVFoundtion Frame work



- (IBAction)btnFlashOnClicked:(id)sender
{
AVCaptureDevice *flashLight = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([flashLight isTorchAvailable] && [flashLight isTorchModeSupported:AVCaptureTorchModeOn])
{
BOOL success = [flashLight lockForConfiguration:nil];
if (success)
{
if ([flashLight isTorchActive])
{
[btnFlash setTitle:@"TURN ON" forState:UIControlStateNormal];
[flashLight setTorchMode:AVCaptureTorchModeOff];
}
else
{
[btnFlash setTitle:@"TURN OFF" forState:UIControlStateNormal];
[flashLight setTorchMode:AVCaptureTorchModeOn];
}
[flashLight unlockForConfiguration];
}
}
}