开发者

Adding a UIPickerView to a UITableView cell

开发者 https://www.devze.com 2023-02-16 23:34 出处:网络
I am trying to add a pickerView to a row in my table view, but after doing this, all I see is a black rectangle inside the cell.

I am trying to add a pickerView to a row in my table view, but after doing this, all I see is a black rectangle inside the cell.

- (UITableViewCell *)tableView:(UITableView *)tabl开发者_JAVA百科eView 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];
    }
}

I really don't have a clue how to solve this. Can anyone help me, please?


May be this can help: DateCell with TableViewController

0

精彩评论

暂无评论...
验证码 换一张
取 消