开发者

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

开发者 https://www.devze.com 2023-03-04 01:11 出处:网络
Hi, I am looking for multi-column table and also want to send that table in email. Is 开发者_StackOverflow社区there any library which can help me ?If see two methods to do this, none of which are

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

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

Is 开发者_StackOverflow社区there any library which can help me ?


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);


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="">

0

精彩评论

暂无评论...
验证码 换一张
取 消