Skip to content

Writing the 'enableURLDetectionWithAttributes' in cellForRowAtIndexPath stops my VC to call dealloc. #44

@vickydhas

Description

@vickydhas

Hello Developer,

Good job on the responsive label code to detect links , below is my code in the cellForRowAtIndexPath definition snippet for reference.

Can help me why the line where the urlTapAction is assigned to enableURLDetectionWithAttributes call parameter stops my dealloc.

I have tried to put the items in background and all still doesn't works.

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                //Do background work
      dispatch_async(dispatch_get_main_queue(), ^{
                    
       PatternTapResponder urlTapAction = ^(NSString *tappedString) {

        [self performSelectorOnMainThread:@selector(openWebViewWithUrlString:) withObject:tappedString waitUntilDone:YES];
                      
                    };
                    
 //Update UI
 [message enableURLDetectionWithAttributes:
                     @{NSForegroundColorAttributeName:[UIColor blueColor],NSUnderlineStyleAttributeName:[NSNumber numberWithInt:1], RLTapResponderAttributeName:urlTapAction}];
                    
                });
            });

Comment this line and the dealloc gets called.

[message enableURLDetectionWithAttributes:
                     @{NSForegroundColorAttributeName:[UIColor blueColor],NSUnderlineStyleAttributeName:[NSNumber numberWithInt:1], RLTapResponderAttributeName:urlTapAction}];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions