试图在我的应用程序内的推文中发布屏幕截图.. 到目前为止,我已经将它保存到库中,但我需要发布它......这里是截图和空的推特帖子......
- (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:@""]];
...........
无法弄清楚在 imageNamed 中输入什么...