i'm not sure if possible, hope , need doing if so.
have mainview in have nsmutabledictionary.
in dictionary key (identity) gives name text entered in 1 textfield.
key (number key) gives name text entered in second textfield
after these 2 fields entered button bar clicked , keyboard disappears , .txt files stored in documents directory.
key (photokey) in dictionary sets path , gives name photo user takes camera.
wish have text entered second textfield name photo given in key (photokey).
lets user enters number 1 (numberkey) textfield. want name of photo in (photokey) 1.jpg.
possible?
here code;
mainview handing off nsmutabledictionary;
in detailviewcontroller use take picture;code:- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { const nsdictionary *const row = [self rowforindexpath:indexpath]; nsstring *wantedclassname = [row objectforkey:@"controller"]; uiviewcontroller *const vc = [[nsclassfromstring (wantedclassname) alloc] init]; nslog(@"controller -%@-", wantedclassname); if ([vc iskindofclass:[detailviewcontroller class]]) { detailviewcontroller*lcvc =(detailviewcontroller*)vc; nsmutabledictionary *mydictionary = [nsmutabledictionary dictionarywithobjectsandkeys: //i have tried isn't working, names photo (image name.txt).jpg @"documents/(imagename.txt).jpg",@"photokey", @"name.txt", @"identity", @"imagename.txt",@"numberkey",nil]; lcvc.mydictionary = mydictionary; nslog(@"photokey");//i know isn't correct, how exact name of photo this? } [self.navigationcontroller pushviewcontroller:vc animated:yes];
code:-(ibaction)getphoto:(id)sender { uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; picker.delegate = self; picker.sourcetype = uiimagepickercontrollersourcetypecamera ; [self presentmodalviewcontroller: picker animated:yes]; } -(void)imagepickercontrollerdidcancel:(uiimagepickercontroller *) picker { [picker dismissmodalviewcontrolleranimated:yes]; } - (void) imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { uiimage *image = [info objectforkey:@"uiimagepickercontrolleroriginalimage"]; nsstring *jpgpath = [nshomedirectory() stringbyappendingpathcomponent:[(nsmutabledictionary *)mydictionary objectforkey:@"photokey"]]; // access uncropped image info dictionary nserror *error; [uiimagejpegrepresentation(image, 0.5) writetofile:jpgpath atomically:yes]; nsfilemanager *filemgr = [nsfilemanager defaultmanager]; nsstring *documentsdirectory = [nshomedirectory() stringbyappendingpathcomponent:@"documents"]; nslog(@"documents directory: %@", [filemgr contentsofdirectoryatpath:documentsdirectory error:&error]); }
ideas appreciated!
you're storing name of image file nsstring, right? so, should 'formatting string' (that's big hint) hold need.
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment