Adding a UIPickerView to a UITableView Cell

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

- (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]; } } 

I really don't know how to solve this. Can someone help me please?

+4
source share
1 answer
+9
source

Source: https://habr.com/ru/post/1343907/


All Articles