2012-02-25 108 views
1

我想在我的iPhone应用程序中应用不同的边框图像。我从相机捕捉图像。现在我有一些不同的边框,我想将该边框应用于图像。我怎么做 ??iphone中的边框图像

回答

2
- (UIImage*)imageWithBorderFromImage:(UIImage*)source 
{ 
    CGSize size = [source size]; 
    UIGraphicsBeginImageContext(size); 
    CGRect rect = CGRectMake(0, 0, size.width, size.height); 
    [source drawInRect:rect blendMode:kCGBlendModeNormal alpha:1.0]; 

    CGContextRef context = UIGraphicsGetCurrentContext(); 
    CGContextSetRGBStrokeColor(context, 1.0, 0.5, 1.0, 1.0); 
    CGContextStrokeRect(context, rect); 
    UIImage *testImg = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 
    return testImg; 

}

+0

感谢aadil哈菲兹 – DipakSonara 2012-02-27 08:53:58