void * p;The name of the blog comes from the world of software development. In the C, C++, and C# programming languages (and perhaps others), a void pointer is a variable containing an address in memory. The above line of code declares a void pointer named "p" that has not yet been set to an address. What is stored at the address is left unspecified and usually the void pointer is converted to be a pointer to a specific type (cast) before it is used. This construct gives the developer quite a bit of power, but as Uncle Ben said, "with great power, comes great responsibility". The developer can very easily shoot themselves in the foot with a void pointer, but when used carefully and in the right circumstances, one can accomplish wonderful things.
Monday, July 18, 2011
Void Pinter Meaning
Void Pinter Meaning :
Thursday, July 7, 2011
PDF File attached in Email Composer in iPhone .
This piece of code also shows you how to attach pdfs as well.
UIButton *emailPdfButton=[[UIButton alloc]initWithFrame:CGRectMake(10, 10, 100, 40)];
[emailPdfButton setBackgroundColor:[UIColor greenColor]];
[emailPdfButton addTarget:self action:@selector(emailPdf:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:emailPdfButton];
-(IBAction)emailPdf:(id)sender{
//find if email exists
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
//find atleast one email account is set up
if([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
[controller setMessageBody:nil isHTML:YES];
[controller setSubject:@"Subject."];
[controller setMessageBody:@"Body Of Email." isHTML:NO];
[controller setToRecipients:[NSArray arrayWithObjects:nil,nil]];
[controller addAttachmentData:[NSData dataWithContentsOfFile:[self GetPdfFilePath]]mimeType:@"application/pdf" fileName:@"file.pdf"];
controller.navigationBar.tintColor = [UIColor grayColor];
[controller setMailComposeDelegate:self];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else
{
//display the alert that set up an email account
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please set up your email account on device." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}
else
{
//display the alert that email account not available
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"No valid email account available on device." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
NSString *message = @"";
switch (result) {
case MFMailComposeResultCancelled:
message = @"Email Canceled";
break;
case MFMailComposeResultSaved:
message = @"Email Saved";
break;
case MFMailComposeResultSent:
message = @"Email Sent";
break;
case MFMailComposeResultFailed:
message = @"Email Failed";
break;
default:
message = @"Email Not Sent";
break;
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nilcancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
[controller dismissModalViewControllerAnimated:YES];
}
Special Thanks for Mobile and Social NEtwork Technology.
Dinesh Sharma
Tuesday, July 5, 2011
iPhone iPad : check the current device and set the nib manually.
ActiveJobDetail *objActiveDetail;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
objActiveDetail = [[ActiveJobDetail alloc]initWithNibName:@"ActiveJobDetail-iPad" bundle:nil];
}
else
#endif
{
objActiveDetail = [[ActiveJobDetail alloc]initWithNibName:@"ActiveJobDetail" bundle:nil];
}
//ActiveJobDetail *objActiveDetail = [[ActiveJobDetail alloc]initWithNibName:@"ActiveJobDetail" bundle:nil];
[self.navigationController pushViewController:objActiveDetail animated:YES];
[objActiveDetail release];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
objActiveDetail = [[ActiveJobDetail alloc]initWithNibName:@"ActiveJobDetail-iPad" bundle:nil];
}
else
#endif
{
objActiveDetail = [[ActiveJobDetail alloc]initWithNibName:@"ActiveJobDetail" bundle:nil];
}
//ActiveJobDetail *objActiveDetail = [[ActiveJobDetail alloc]initWithNibName:@"ActiveJobDetail" bundle:nil];
[self.navigationController pushViewController:objActiveDetail animated:YES];
[objActiveDetail release];
Subscribe to:
Posts (Atom)