iPhone:How to add custom button on Dynamic Label in particular text?
<p>Hello friends,</p>

<p>This is below my code.</p>

<pre><code>         @interface DynamicLabel : UILabel

      {

      }

         - (id) getSize:(NSString *)text FontName:(NSString *)f_name FontSize:(float)f_size label:  (UILabel *)templbl;

     @end


      #import "DynamicLabel.h"

      #define DEFAULT_COLOR [UIColor blackColor] 

      @implementation DynamicLabel


      - (id)initWithFrame:(CGRect)frame 
     {
        if ((self = [super initWithFrame:frame])) 
     {

         }
         return self;
    }

    //function for dynamically get size of label 
     - (id) getSize:(NSString *)text FontName:(NSString *)f_name FontSize:(float)f_size label:(UILabel *)templbl
     {
         templbl.numberOfLines = 0;
         [templbl setFont:[UIFont fontWithName:f_name size:f_size]];
         [templbl setLineBreakMode:UILineBreakModeWordWrap];

         CGSize maximumLabelSize = CGSizeMake(310,9999);

         CGSize expectedLabelSize = [text sizeWithFont:templbl.font
                                constrainedToSize:maximumLabelSize 
                                                 lineBreakMode:templbl.lineBreakMode];

         CGRect newFrame = templbl.frame;
         NSLog(@"New Frame:---&gt;%@",NSStringFromCGRect(newFrame));
         newFrame.size.height = expectedLabelSize.height;
         NSLog(@"New Frame Height:---&gt;%f",newFrame.size.height);
         templbl.frame = newFrame;
         NSLog(@"Temp Label Frame:---&gt;%@",NSStringFromCGRect(templbl.frame));
         [templbl setText:text];
         NSLog(@"Temp Label Text:---%@",templbl.text);
         [templbl sizeToFit];

         return templbl;
       }
</code></pre>

<p><strong>I used above code in RootViewController and success dynamically get height of label</strong></p>

<pre><code>      #import "DynamicLabel.h"

      @interface RootViewController : UIViewController 
     {
       DynamicLabel *dlabel;    
     }

     @property (nonatomic,retain) DynamicLabel *dlabel;

     -(void)dynamiclabel;

     @end

        #import "RootViewController.h"
        #define LABELS_FONT_NAME_BOLD @"Helvetica-Bold"

        #define FONT_GREEN_COLOR [UIColor colorWithRed:0.122f green:0.416f blue:0.20f alpha:1.0f]

        @implementation RootViewController
        @synthesize dlabel;

        #pragma mark -

        #pragma mark View lifecycle


        - (void)viewDidLoad {
           [super viewDidLoad];
       self.title = @"Label Navigation Demo";
        }

        -(void)dynamiclabel
       {
         dlabel = [[DynamicLabel alloc] initWithFrame:CGRectMake(30, 130, 300, 20)];

        [dlabel getSize:@"Choose a topic from the left to find answers for your questions about iPhone. For the latest downloads, manuals, and other resources for iPhone, choose an option below."  
FontName:LABELS_FONT_NAME_BOLD FontSize:12.5f label:dlabel];
        dlabel.textColor = FONT_GREEN_COLOR;
        dlabel.backgroundColor = [UIColor clearColor];
        NSLog(@"Dynamic Label Height:---&gt;%f",dlabel.frame.size.height);
            [self.view addSubview:dlabel];
        }
</code></pre>

<p>My issue is that I want to add custom button dynamically wherever iPhone text is displayed in label text. Is there any way to develop this functionality?</p>

<p>Thanks in advance. </p>
