0

UPDATE: It appears to be my custom cell code that is slowing things down, when I used the frameworks UITableViewCell there is no delay when performing the segue.

Here is the custom tableview cell (which draws a background like a chat bubble):

@implementation SGEMessageCell

@synthesize defaultColor;
@synthesize backgroundView;
@synthesize backgroundRect;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // controls
        self.dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 290, 30)];
        self.dateLabel.textColor = [UIColor lightGrayColor];
        self.dateLabel.font = [UIFont fontWithName:@".HelveticaNeueInterface-Regular" size:10.0f];

        self.descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 25, 300, 30)];
        self.descriptionLabel.textColor = [UIColor whiteColor];
        self.descriptionLabel.font = [UIFont fontWithName:@".HelveticaNeueInterface-Regular" size:14.0f];

        backgroundView = [self createBackgroundView:self.defaultColor];
        backgroundView.tag = @"backgroundTag";

        [self addSubview:backgroundView];
        [self addSubview:self.dateLabel];
        [self addSubview:self.descriptionLabel];

        [self setNeedsDisplay];
    }
    return self;
}

@end

That is the super class for two others event and action, here's an event:

@implementation SGEEventCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self.defaultColor = [UIColor colorWithRed:0.91 green:0.91 blue:0.91 alpha:1];
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    return self;
}

- (UIView *)createBackgroundView:(UIColor *)color
{
    CGRect background = CGRectMake(10, 25, self.frame.size.width - 60, 90);
    UIView *backgroundView = [[UIView alloc] initWithFrame:background];
    backgroundView.backgroundColor = color;
    [backgroundView.layer setCornerRadius:7.0f];
    [backgroundView.layer setMasksToBounds:YES];
    return backgroundView;
}

- (void)updateBackgroundViewColor:(UIColor *)color
{
    UIView *bg = [self viewWithTag:@"backgroundTag"];
    bg.backgroundColor = color;
}

@end

/UPDATE

I have the following code in my main view controller (a table view)

- (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"eventDetailsSegue" sender:self];
}

Originally it did have code which stored the selected cell's index but I removed it to see if it would fix the glitch/delay when the segue was performed but it still happens. The glitch is that you often have to touch twice on a cell for the segue to perform the first time, and from then on intermittent touches cause delayed segue transitions.

The target view controller was using FXForms but I've removed that as well to try and resolve the glitch so now it's an empty view controller with a ui builder linked dismiss message.

@implementation SGEEventDetailsViewController

- (IBAction)dismiss:(id)sender
{
    [self.presentingViewController dismissViewControllerAnimated:YES
                                                      completion:NULL];
}

@end

thanks!

kreek
  • 8,774
  • 8
  • 44
  • 69
  • Is there a reason why you're invoking segue yourself and not binding it from the storyboard? – sha Nov 10 '14 at 22:31
  • There is a storyboard where the segue is defined. However, the table view uses dynamic data with a code generated cell (cells are polymorphic based on their data) so I don't think (but I could be wrong!) that you could bind it from the storyboard. – kreek Nov 10 '14 at 22:38
  • Did you try adding NSLog to the didSelect method to see if it calls without any delays and without glitches? – sha Nov 10 '14 at 22:41
  • Yes :) log traces out a message and then the segue happens (sometimes a few seconds afterward), I also have a similar call to another performWithSegue (not inside a tableView method) and it works without delay. – kreek Nov 10 '14 at 22:45
  • Do you have any custom prepareForSegue methods? – sha Nov 10 '14 at 22:45
  • No custom prepareForSegue methods. – kreek Nov 10 '14 at 22:46
  • Try to add NSLog timestamps for viewWillDissaper and viewDidDissapear for the source view controller - to see if it's related to the source view layout complexity – sha Nov 10 '14 at 22:48
  • Those two calls never have more than a second diff, but from didSelect... until viewWillDisappear was delayed 2014-11-10 14:56:08.529 Demo[19094:1785824] press 2014-11-10 14:56:14.753 Demo[19094:1785824] viewWillDisappear 2014-11-10 22:56:14 +0000 – kreek Nov 10 '14 at 22:58
  • How complex your original table view? – sha Nov 10 '14 at 22:59
  • It's a chat style log view with n cells (but even a few are slow) they use `dequeueReusableCellWithIdentifier` it also has a toolbar at the bottom of the view with three buttons (one of which opens an action sheet) – kreek Nov 10 '14 at 23:06
  • It can be related to view layout... Hard to say anything without looking closer to the code. Is there way you can separate this issue into simple test application? – sha Nov 10 '14 at 23:12
  • Ya that's probably the next step, thanks so much for your time :) – kreek Nov 10 '14 at 23:15
  • 1
    Little bit late but I think I found your solution: http://stackoverflow.com/questions/25007045/xcode-6-beta-swift-performseguewithidentifier-has-delay-before-segue – Lachezar Todorov Mar 05 '15 at 12:25

0 Answers0