Wednesday 15 January 2014

ios - PFImageView Memory Problems -


I'm having a problem with a custom collection view of PFImages in the way the parsing is taking too much memory , I only have 7 objects, but while loading the archive view, the memory is reaching 1.1 gigabytes.

Custom cell

  - InitWithFrame: (CGRect) frame {self = [super initWithFrame: frame ]; If (self) {[auto setup]; } Healthy return; } - (id) initWithCoder: (NSCoder *) anotherDecoder {self = [super initWithCoder: anotherDecoder]; If (self) {[auto setup]; } Healthy return; } - (zero) setup {self.pictureImageView = [[PFImageView alloc] init]; Self.pictureImageView.frame = CGRectMake (0, 0, self.pictureView.frame.size.width, self.pictureView.frame.size.height); [Self.contentView addSubview: Picture Image View]; }  

View archive code

  - See the (UICollectionViewCell *) collection: (UICollectionView *) collectionView cellForItemAtIndexPath: (NSIndexPath * ) IndexPath {Image ViewCell * cell = (Pictorial Collection) * [collectionView dequeueReusableCellWithReuseIdentifier: "cell" for cell: indexpath]; TempObject = [Image: ObjectAutIndex: IndexPath.ro]; PF file * file = [tempObject objectForKey: @ "thumbnail"]; Cell.pictureImageView.file = File; Cell.pictureImageView.image = [UIImage imageNamed: @ "LOADING.png"]; [Cell. PictureMageView Load Inboxing]; Cell. Picture EasyViewConcond Mode = UIViewContentModeScaleAspectFill; Cell.titleLabel.text = [tempObject objectForKey: @ "title"]; NSLog (@ "image:% @, file:% @, on index:% li", cell picture image view image, cell picture image view file, indexpath.ro); Return cell; } Parsing is horrible with this situation ... code will trigger a net when the    

It receives a memory alert, it sometimes helps:

  - Remove (zero) cache files [[PPCXxAcid Cached Result]; NSString * cacheDir = [NSSearchPathForDirectoriesInDomains (NSCachesDirectory, NSUserDomainMask, Yes) objectAtIndex: 0]; NSString * nsurlDir = [[NSString alloc] initWithFormat: @ "% @ / YOUR_BUNDLE_ID", cashdair]; NSFileManager * manager = [NSFileManager defaultManager]; // Hold all the files in the documents. NSArray * allFiles = [Manager Contentoff DirectoryEat Path: nsurlDir Error: Zero]; // Only filter array for sqlite files NSPredicate * fltr = [NSPredicate predicateWithFormat: @ "self endswith '.db']]; NSArray * dbFiles = [Use all filtered filtered applications: fltr]; // iterate the array Use fast calculation and delete files (dbFiles in NSString * dbFile) {NSError * error = nil; [delete manager: IMT path: [NSUrlDIR stringbappingpathcomponent: DBFfile] error: & amp; error; if (Error! = Zero) {nslog (@ "error:% @", [error] Details]);} Click on the other {NSLog (@ "DB file was cleared:% @", dbf file);}}}  

No comments:

Post a Comment