---
title: isDataRetained
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsimage/isdataretained
---

# isDataRetained

Returns a Boolean value that incidates whether the image retains its source image data.

## Declaration

```occ
- (BOOL) isDataRetained;
```

## Return Value

Return Value true if the image retains its source data; otherwise, false. The default value is false with some exceptions, which are covered in the discussion.

## Discussion

Discussion For image objects initialized using either the init(byReferencingFile:) or init(byReferencing:) method, this value is true by default. The reason is that for these methods, data retention simply involves retaining the filename or URL. Data retention increases the memory used by the NSImage object and its image representations.

## See Also

### Instance Methods

- [lockFocus()](appkit/nsimage/lockfocus().md)
- [lockFocusFlipped(_:)](appkit/nsimage/lockfocusflipped(_:).md)
- [unlockFocus()](appkit/nsimage/unlockfocus().md)
- [init(iconRef:)](appkit/nsimage/init(iconref:).md)
- [lockFocusOnRepresentation:](appkit/nsimage/lockfocusonrepresentation:.md)
- [bestRepresentationForDevice:](appkit/nsimage/bestrepresentationfordevice:.md)
- [compositeToPoint:operation:](appkit/nsimage/compositetopoint:operation:.md)
- [compositeToPoint:fromRect:operation:](appkit/nsimage/compositetopoint:fromrect:operation:.md)
- [compositeToPoint:fromRect:operation:fraction:](appkit/nsimage/compositetopoint:fromrect:operation:fraction:.md)
- [compositeToPoint:operation:fraction:](appkit/nsimage/compositetopoint:operation:fraction:.md)
- [dissolveToPoint:fraction:](appkit/nsimage/dissolvetopoint:fraction:.md)
- [dissolveToPoint:fromRect:fraction:](appkit/nsimage/dissolvetopoint:fromrect:fraction:.md)
- [setScalesWhenResized:](appkit/nsimage/setscaleswhenresized:.md)
- [scalesWhenResized](appkit/nsimage/scaleswhenresized.md)
- [setDataRetained:](appkit/nsimage/setdataretained:.md)
