// // XPRoomPositionView.m // xplan-ios // // Created by 冯硕 on 2021/10/15. // #import "XPRoomPositionView.h" @interface XPRoomPositionView () ///UI相关的 @property (nonatomic,strong) id layout; @end @implementation XPRoomPositionView - (instancetype)initWithFrame:(CGRect)frame layout:(id)layout { self = [super initWithFrame:frame]; if (self) { self.layout = layout; [self initSubViews]; } return self; } #pragma mark - Private Method - (void)initSubViews { int number = [self.layout numberOfItems]; NSArray * array = [self.layout getPositionItemsRect]; for (int i = 0; i < number; i++) { UIView * view = [self getItemView]; NSValue * rect = [array objectAtIndex:i]; view.frame = rect.CGRectValue; [self addSubview:view]; } } #pragma mark - XPRoomPositionLayoutProtocol - (UIView *)getItemView { Class class = [self.layout classOfPositionItme]; return [[class alloc] init];; } @end