Questions tagged «nsdocument»

4
将图像保存到“文档”目录并检索电子邮件附件
我在查明NSBundle&DocumentDirectory数据时遇到问题,我有一个要保存到的相机图片“ imageView ”,NSDocumentDirectoy然后想要检索它以附加到电子邮件中, 这里保存代码: - (IBAction)saveImage { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"]; UIImage *image = imageView.image; // imageView is my image from camera NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:NO]; } 这是新的获取数据代码: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString …
72 ios  iphone  email  nsdocument 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.