/// 初始化子控件 - (void)setupViews { // _nameField = [[UITextField alloc] initWithFrame:CGRectMake(0, 22, ScreenWidth, 44)]; _nameField.placeholder = @"请输入姓名"; [self.view addSubview:_nameField]; _ageField = [[UITextField alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_nameField.frame), ScreenWidth, 44)]; _ageField.placeholder = @"请输入年龄"; [self.view addSubview:_ageField]; _infoField = [[UITextField alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_ageField.frame), ScreenWidth, 44)]; _infoField.placeholder = @"请输入简介"; [self.view addSubview:_infoField]; _timeField = [[UITextField alloc] initWithFrame:CGRectMake(0,CGRectGetMaxY(_infoField.frame),ScreenWidth, 44)]; _timeField.text = [self getCurrentDate]; _timeField.enabled = NO; [self.view addSubview:_timeField];
_collectionView = [[SLQCollectionView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_timeField.frame),ScreenWidth, 100)]; [_collectionView setTitle:@"相关照片"]; __weak typeof (self)weakSelf = self; _collectionView.heightAndPhotosBlock = ^(CGFloat height,NSArray *photos){ [weakSelf.photoArr removeAllObjects]; weakSelf.photoArr = [NSMutableArray arrayWithArray:photos]; };
[self.view addSubview:_collectionView]; _mergePhoto = [[UIButton alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_collectionView.frame), 100, 44)]; [_mergePhoto setTitle:@"发布" forState:UIControlStateNormal]; _mergePhoto.backgroundColor = [UIColor redColor]; [_mergePhoto addTarget:self action:@selector(postPhoto) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:_mergePhoto]; _mergePhoto.center = CGPointMake(ScreenWidth/2, _mergePhoto.center.y); _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 200)]; _contentLabel.hidden = YES; [self.view addSubview:_contentLabel]; }
|