Wednesday, September 2, 2009

To set an image as background of iPhone UIView!!

Include an image of png extension in your project bundle and paste following line of code with your image name in viewDidLoad....


NSString *backgroundPath = [[ NSBundle mainBundle ] pathForResource : @"login" ofType : @"png" ];


UIImage *backgroundImage = [ UIImage imageWithContentsOfFile :backgroundPath];


UIColor *backgroundColor = [[ UIColor alloc ] initWithPatternImage :backgroundImage];


self .view.backgroundColor = backgroundColor;


[backgroundColor
release ];


No comments:

Post a Comment