gpt4 book ai didi

objective-c - 将 UIPickerView 添加到 UITableView 单元格

转载 作者:太空狗 更新时间:2023-10-30 03:59:49 27 4
gpt4 key购买 nike

我正在尝试将 pickerView 添加到我的 TableView 中的一行,但在执行此操作之后,我所看到的只是单元格内的一个黑色矩形。

- (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

关于objective-c - 将 UIPickerView 添加到 UITableView 单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5324645/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com