0
我有這段代碼用於在推文上發送圖像。當我嘗試應用程序時,選取器運作良好,但它不抓住圖像。怎麼了?UIImagePickerController出錯
- (IBAction)sendImageTweet:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
picker.allowsEditing = NO;
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSData *imageData = UIImagePNGRepresentation(image);
[self dismissModalViewControllerAnimated:YES];
[tweetViewController addImage:(UIImage *)imageData];
[self presentModalViewController:tweetViewController animated:YES];
}
對不起,但我是新的iOS開發......我怎樣才能使用常量和關鍵? –