开发者

NSCoding doesn't seem to store the frame of my UIImageView

I can't seem to get NSCoding to store the 'frame' or 'center' properties of my UIImageView subclassed object. It seems to store everything else, both custom properties and standard class properties (e.g. 'hidden', etc...), but not the 'frame' or 'center' properties. 开发者_运维知识库I'm NOT trying to archive a UIImage (as this does not comply with NSCoding).

I will post code if needed but I'm not doing anything special to the 'frame' other than setting it.

Any ideas?


Frame is based on the parents coordinate system and there is no parent until you add the view. If you have a subclass you could override the coding methods and store the frame yourself, although it might not end up being in the right position based on the parent view.


You could store that frame as a string using NSStringFromCGRect() and then read it back later using CGRectFromString(). However, it is all based on the parent view frame so just keep that in mind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜