Flicker Images

Find programmers and grapic design experts at ScriptLance.com

Tuesday, September 29, 2015

Set Background Image to UILabel Properly in iOS




How you will set a background image to UILabel.
I searching different site and stackoverflow following code is solve my purpose. This code help me set a image and to fit / shrink according to size of UILabel.



    UIImage *img = [UIImage imageNamed:@"yourimage.png"];
    CGSize imgSize = self.YourLabelName.frame.size;
    
    UIGraphicsBeginImageContext( imgSize );
    [img drawInRect:CGRectMake(0,0,imgSize.width,imgSize.height)];
    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    

    self.YourLabelName.backgroundColor = [UIColor colorWithPatternImage:newImage];
Share:

Friday, September 11, 2015

iPhone UITextField - Change placeholder text color



We can Change the Placeholder textcolor to any color which you want by using the below code.


    UIColor *color = [UIColor whiteColor];
  
    self.txtUserName.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Username" attributes:@{NSForegroundColorAttributeName: color}];
Share:

Game Reviews

BTemplates.com

Powered by Blogger.

Search This Blog

Video Of Day

Find Us OIn Facebook

Blogroll

Contact

Tackle the Web with up to 5 new .COMs, $5.99 for the 1st year!

Advertisement