You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
966 B
39 lines
966 B
// |
|
// XHViewState.m |
|
// XHImageViewer |
|
// |
|
// Created by 曾 宪华 on 14-2-17. |
|
// Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. |
|
// |
|
|
|
#import "XHViewState.h" |
|
|
|
@implementation XHViewState |
|
|
|
+ (XHViewState *)viewStateForView:(UIView *)view { |
|
static NSMutableDictionary *dict = nil; |
|
if(dict == nil) { |
|
dict = [NSMutableDictionary dictionary]; |
|
} |
|
|
|
XHViewState *state = dict[@(view.hash)]; |
|
if(state == nil) { |
|
state = [[self alloc] init]; |
|
dict[@(view.hash)] = state; |
|
} |
|
return state; |
|
} |
|
|
|
- (void)setStateWithView:(UIView *)view { |
|
CGAffineTransform trans = view.transform; |
|
view.transform = CGAffineTransformIdentity; |
|
|
|
self.superview = view.superview; |
|
self.frame = view.frame; |
|
self.transform = trans; |
|
self.userInteratctionEnabled = view.userInteractionEnabled; |
|
|
|
view.transform = trans; |
|
} |
|
|
|
@end
|
|
|