iOS 7 slow to open UITableViewController with UIPickerView

Accordingly to this question and the kind answer of KyleC I've implemented a UITableViewController which has many rows relying on a fetch from Core Data. Every row display a simple NSString (name of the object fetched) and has an UIPickerView hidden.

The issue is that it's absolutely evident that when I tap the row in the previous UITableViewController that opens the UITableViewController with picker views there's some delay in the segue transition.

I know this because the previous controllers (they even perform Core Data requests) are not so slow in the transition.


Can some UIPickerViews make the transition so slow and pretty ugly? In which mode should I use Instruments to understand which is the slowly-guilty?

More important: if the slowness is derived from the numbers of UIPickerViews how can I optimize this?

I want to clarify that the app is very light and the fetched objects from Core Data are only 4, with 4 UIPickerViews.


It seems that UIPickerViews and UIDatePickers load very slowly from storyboards (and possibly xib's, but I haven't tried). On an iPad Air it's taking around 3 seconds to load a static UITableViewController that contains 4 UIPickerViews and 8 UIDatePickers in "hidden" cells. (3 seconds is an eternity for a native UI running on the latest and greatest hardware!)

The workaround I found is to create the UIPickerViews and UIDatePickers programmatically before the hidden row is revealed. What I did was create empty cells in Interface Builder, link those cells to IBOutlet properties, and then create the DatePickers and Picker views with these methods:

- (UIDatePicker*)datePickerForCell:(UITableViewCell*)cell {
    UIDatePicker * datePicker = [[UIDatePicker alloc] initWithFrame:cell.bounds];
    [datePicker setDatePickerMode:UIDatePickerModeDateAndTime];
    [datePicker addTarget:self action:@selector(pickerDateChanged:) forControlEvents:UIControlEventValueChanged];
    datePicker.hidden = YES;
    [cell addSubview:datePicker];

    return datePicker;

- (UIPickerView*)pickerViewForCell:(UITableViewCell*)cell {
    UIPickerView * picker = [[UIPickerView alloc] initWithFrame:cell.bounds];
    [picker setDelegate:self];
    [picker setDataSource:self];
    picker.hidden = YES;
    [cell addSubview:picker];
    return picker;

This reduced the load time for the UITableViewController to a few tenths of a second and it doesn't seem to affect the animation of showing a hidden tableview.

Note: I did try creating the pickers in the viewDidAppear: method, but it still seemed to delay the UI.

Need Your Help

C programming: Using a variable inside another variable name (not sure of the technical term)

c variables

I don't know what the technical term is but I would like to do following:

Interactively Run code against Grails Runtime Environment

debugging grails groovy

I am working on some code to load some bootstrapping data into my Grails app. Something is not working with one of the classes I am trying to create, so it would be very convenient to be able to run