3

i had inserted UIimage inside uitextview as NSTextAttachment using nsattributedstring.

Now because of some default property for attrbutestring i am getting long press event on my image.

i.e When i do long press in UIImage it got UIActionsheet giving me option to "SAVE IMAGE" or "COPY".

I had not written any code for this..

What i actully want on the long press of UIIMAGE is i want to open that small UIIMAGE into my full screen like we have in whatapp like chatting. When user send some image and user click on that image it get displayed in full screen.

Any one please help me to customise this click event of nstextattachment.

 NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"Somestring"];

        CGRect rect = CGRectMake(0,0,100,100);
        UIGraphicsBeginImageContext( rect.size );
        [image drawInRect:rect];
        UIImage *picture1 = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();

        NSData *imageData = UIImagePNGRepresentation(picture1);
        UIImage *img=[UIImage imageWithData:imageData];

        NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
        textAttachment.image =img;
        NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment];
       [attributedString replaceCharactersInRange:NSMakeRange(0,0) withAttributedString:attrStringWithImage];
    UITextView *messageContentView=[[UITextView alloc] init];
    messageContentView.attributedText=attributedString;
ios developer
  • 3,057
  • 2
  • 43
  • 93
  • http://stackoverflow.com/questions/22379595/uitextview-link-tap-recognition-is-delayed this may help u.! – cdon Jan 24 '15 at 11:51
  • @cdon thanks for the quick reply.I had integrated this method.But this method is not getting called when i click image.I think this is some delegate method getting called for nstextattachment or uitextview – ios developer Jan 24 '15 at 11:59

0 Answers0