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];
}
}
}


Saturday, 26 December 2015

how to do sql lite connectivity with ios

hello friends.


(1) today i will tell how u doing simple sql lite connectivity with ios. first go to this link--->database files


(2)download this two file called DBoperatrion.h and DBoperation.m file now copy this file in your code


(3) now open dboperation file code and change database which u made
(4)open appdelegate.h file import dboperation.h

(5)ok now open appldelgate.m file and put this code in first method of app delegate
[dboperation checkcreatedb]


"check createdb is method of dboperation which we call"


ok now last if doing query for insert you use execute query and if you want to use data for select query than use select data method


THANK YOU FOR READING




Thursday, 23 July 2015

XML parsing basic Code

in viewcontroller.m file

NSURL *xmlURL=[NSURL URLWithString:@"http://www.espncricinfo.com/rss/content/story/feeds/0.xml"];
NSMutableURLRequest *xmlMainReq=[NSMutableURLRequest requestWithURL:xmlURL];
[xmlMainReq setHTTPMethod:@"GET"];
[xmlMainReq setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-Type"];
NSURLConnection *xmlConnection=[[NSURLConnection alloc]initWithRequest:xmlMainReq delegate:self];
if (xmlConnection)
{
xmlData=[[NSMutableData alloc]init];
}
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
//call at connection failed with any kind of reason...
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[xmlData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[xmlData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
{
xmlParse=[[NSXMLParser alloc]initWithData:xmlData];
xmlParse.delegate=self;
[xmlParse setShouldResolveExternalEntities:YES];
[xmlParse parse];
}




- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
if ([elementName isEqualToString:@"item"])
{
channelDict=[[NSMutableDictionary alloc]init];
}
}