Trying to post a screenshot in a tweet from within my app.. so far i’ve gotten it to save it to the library but I need to tweet it… Here’s a look at the screenshot and the empty twitter post…
- (IBAction)savephoto:(id)sender {
// Returns 1024x768 for iPad Retina
CGSize screenDimensions = [[UIScreen mainScreen] applicationFrame].size;
// Create a graphics context with the target size
// (last parameter takes scale into account)
UIGraphicsBeginImageContextWithOptions(screenDimensions, NO, 0);
// Render the view to a new context
CGContextRef context = UIGraphicsGetCurrentContext();
[customview.layer renderInContext:context];
// Save to Camera Roll
CGRect contentRectToCrop = CGRectMake(18, 14, 602, 460);
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
CGImageRef imageRef = CGImageCreateWithImageInRect([screenshot CGImage], contentRectToCrop);
UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
UIImageWriteToSavedPhotosAlbum(croppedImage, self, nil, nil);
UIGraphicsEndImageContext();
………
- (IBAction)tweetphoto:(id)sender {
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
[twitter setInitialText:@"Enter tweet here!"];
[twitter addImage:[UIImage imageNamed:@""]];
……..
Can’t figure out what to type in the imageNamed…
1 Answer