save - Saving contents of UITextview for further editing -


i have uitextview attributed strings , uiimageviews / uiviews subviews of uitextview. save entire uitextview (with subviews), that, can later edited. have come across nskeyedarchiver code snippet :

- (nsdata *)dataforview:(uiview *)view     {         nsmutabledata *data = [nsmutabledata data];         nskeyedarchiver  *archiver = [[nskeyedarchiver alloc] initforwritingwithmutabledata:data];         [archiver encodeobject:view forkey:@"view"];         [archiver finishencoding];         return (id)data;    } 

but, per thread nskeyedarchiver returning nil uiview's subviews, nskeyedarchiver should not used save entire uiviews.

saving image,

uigraphicsbeginimagecontext(self.view.frame.size); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage* image1 = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); nsdata *imagedata = uiimagepngrepresentation(image1); [imagedata writetofile:mypath atomically:yes]; 

does not appear solution, because, app should support re-editing , re-saving.

saved in pdf format successfully, but, can reload pdf uitextview editing ? per thread, displaying pdf content in uitextview, not possible !

would solution this. appreciated.

p.s. cannot subsitute uitextview uiwebview.

sounds coredata way go.

you'll need simple sqlite database schema can store text relevant text attributes. images of uiimageviews can written disk in suitable format, , x, y values of uiimageviews can saved database along saved image file names.

upon resumption editing, recreate uitextview , uiimageview subviews reading sqlite database.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -