0

First off I have an app that provides the user information about the amount of air miles they have travelled based on their input. This information is displayed in many different conversions on a UITableView, for example it shows the amount of centimeters you have travelled and the amount of kilometers you have travelled. All the values are double, now what I want to do with this data is share it. I have decided to choose Facebook, In-App Email, SMS and Twitter. I could display/share the data like this:

Kilometres      2000.28

Miles          1400.33

Centimetres     20000000.238 

Yards            100039.02

(Values are made up)

But that would be impractical and quite ugly, especially for twitter. So I had an idea to display it as a data table template, like below. (Except with the text in of course!) How could I do this? Would I display it and attach it as an image, or text? Are there any APIs out there that can do this?

Visual Representation:

Data Table

3
  • Why not just shorten it for twitter then? Make the user select only one of those values to share and explain somewhere about the character limit. Commented May 27, 2012 at 3:25
  • What do you mean, "like below"? I'm trying to get a visual of what you're trying to achieve. :) Commented May 27, 2012 at 3:27
  • sorry I thought I published it, I'm so stupid ill put it up :) Commented May 27, 2012 at 3:38

1 Answer 1

1

I would dynamically create a UIView with the layout you want and turn that into an image via UIGraphicsGetImageFromCurrentImageContext(), example class method below. After generating the UIImage post that to Facebook..

+ (UIImage *) imageWithView:(UIView *)view {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage * img = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return img;
}
Sign up to request clarification or add additional context in comments.

1 Comment

ahhh I never thought of that, great idea! Accepted!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.