Devang
Devang

Reputation: 11338

How to make multi-column table in iPhone & formate it for the email as shown in image?

enter image description here

Hi, I am looking for multi-column table and also want to send that table in email.

Is there any library which can help me ?

Upvotes: 1

Views: 3327

Answers (2)

Jason Cragun
Jason Cragun

Reputation: 3233

If see two methods to do this, none of which are "straight out of the box".

method 1. Use a UIWebView, build your html as a string and load it right into the UIWEbView using the.. loadHTMLString method. this way, you have a handle on your html, and can directly write the same html to an email. having said this, its not the method that I would use. IOS, is about a rich client experience.. and UIWebView is... well.. a web view...

so.. method 2.

roll your own custom table as posted by Aravindhanarvi.. then when you want to send an email... render your view to an image.. and add that image to your email.

here is the code to render a view as an image..

UIGraphicsBeginImageContext(webview.frame.size);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

Upvotes: 2

jnpdx
jnpdx

Reputation: 52416

For the email part of it:

When you call setMessageBody: make sure isHTML:YES is used.

Then, you can format your whole message as HTML -- then, you can make the table the same way you would on a website. Careful with CSS -- lots of email clients are picky about it. If you use it, use it inline in the elements, eg: <table style="">

Upvotes: 0

Related Questions