objective-c – 将UIPickerView添加到UITableView单元格
发布时间:2020-12-14 18:05:19 所属栏目:百科 来源:网络整理
导读:我试图将pickerView添加到我的表视图中的一行,但在这之后,我看到的只是单元格内的黑色矩形. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *MyIdentifier = @"MyIdentifier";U
我试图将pickerView添加到我的表视图中的一行,但在这之后,我看到的只是单元格内的黑色矩形.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if(cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease]; pickerView = [[[UIPickerView alloc] initWithFrame:CGRectMake(0.0,0.0,200,300)] autorelease]; [cell.contentView addSubview:pickerView]; } } 我真的不知道如何解决这个问题. 解决方法
可能这可以帮助:
DateCell with TableViewController
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |