我使用以下方法将合并后的图像保存到iPhone照片库:
UIImageWriteToSavedPhotosAlbum(viewImage, self, @selector(savedPhotoImage:didFinishSavingWithError:contextInfo:), nil);
Run Code Online (Sandbox Code Playgroud)
并使用以下方式获取回调:
- (void) savedPhotoImage:(UIImage*)image didFinishSavingWithError:(NSError *)error contextInfo: (void *)contextInfo { NSLog(@"%@", [error localizedDescription]);
NSLog(@"info: %@", contextInfo);}
Run Code Online (Sandbox Code Playgroud)
我想得到的是图像保存位置的路径,因此我可以将其添加到一个数组中,该数组将用于调用应用程序中其他位置的已保存项目列表.
当我使用选择器加载图像时,它显示路径信息.但是,当我保存创建的图像时,我无法找到保存图像路径的位置.
我有关于网络的搜索,但是大多数示例都在回调时停止,并提供一条很好的消息,说明图像已成功保存.我只想知道它的保存位置.
我理解一种方法可能是开始定义我自己的路径,但正如该方法为我做的那样,我只是希望它可以告诉我它保存到哪里.
我一直在通过我的应用程序试图处理所有的内存问题和阅读内存管理.我开始使用[object retainCount]来跟踪我的内存分配.这是否值得信任,因为我一直觉得这些计数真的很奇怪?
有人可以解释以下内容:
请记住,这个app委托和一个空的mainViewController没有任何区别.initWithRootViewController导致计数上升,但我没有看到添加一个的另一种方法....
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/* Create the View Controllers */
UIViewController *mainViewControl = [[[MainViewController alloc] init] autorelease];
/* Create the Navigation Controller */
UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:mainViewControl] autorelease];
NSLog(@"retain count: %i",[mainViewControl retainCount]);
/* Set the toolbar to purple */
navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
navigationController.navigationBar.tintColor = [UIColor colorWithRed:.6 green:.1 blue:.4 alpha:0.4];
navigationController.navigationBar.translucent = YES;
NSLog(@"retain count: %i",[mainViewControl retainCount]);
navigationController.toolbar.barStyle = UIBarStyleBlackTranslucent;
navigationController.toolbar.tintColor = [UIColor colorWithRed:.6 green:.1 blue:.4 alpha:0.4];
navigationController.toolbar.translucent = YES;
[navigationController setNavigationBarHidden:YES animated:NO]; …Run Code Online (Sandbox Code Playgroud)