title: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString size]: unrecognized selector sent to instance
body: <p>I am creating <strong>UIButton</strong> dynamically in the <strong>FOR</strong> loop as follows :</p>
  
  <pre><code>     CGRect workingFrame = imgscrollView.frame;
        workingFrame.origin.x = 0;
        workingFrame.origin.y = 0;
  
     for (int i=0 ; i &lt; self.currentDetails.arrayOfImages.count ; i++)
     {
      UIButton *imageBtn = [[UIButton alloc] init];
      [imageBtn setImage:image forState:UIControlStateNormal];
      [imageBtn setUserInteractionEnabled:TRUE];
      imageBtn.layer.cornerRadius = 8;
      imageBtn.layer.borderWidth = 1;
      imageBtn.layer.borderColor = [UIColor whiteColor].CGColor;
      imageBtn.layer.masksToBounds = YES;
      imageBtn.clipsToBounds = YES;
      [imageBtn setContentMode:UIViewContentModeScaleAspectFill];
      [imageBtn addTarget:self action:@selector(changeButtonImage:) forControlEvents:UIControlEventTouchUpInside];
      [imageBtn setTag:i];
      [imgscrollView addSubview:imageBtn];
  
       imageBtn.frame = CGRectMake(workingFrame.origin.x+20, workingFrame.origin.y, 145, 140);
     }
  </code></pre>
  
  <p>But at the time of setting its frame </p>
  
  <p><strong>imageBtn.frame = CGRectMake(workingFrame.origin.x+20, workingFrame.origin.y, 145, 140);</strong></p>
  
  <p>i am getting following error and it crashes :</p>
  
  <p><strong>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString size]: unrecognized selector sent to instance</strong></p>
  
  <p>I have searched for this but could not get the solution.</p>
  
  <p>Please help me.</p>
  
  <p>Thanks...</p>