I am creating a feature that enables the users to share some Images from my App to their Facebook/Twitter account.
The feature works, I implemented the IBAction and I can share some Images within Facebook and Twitter.
My company's marketing department is now asking me to add at the top of the shared images, a banner with the company's logo and the date.
This is what I have to display :
For now I only share the white rectangle. Now I have to add this banner, the blue rectangle.
I was wondering how I will be developing it. First of all I was thinking about drawing it programmatically within a view.
UIView *banner = [[UIView alloc] initWithFrame:CGRectMake(0, 35, self.view.frame.size.width, 60)];
banner.backgroundColor = [UIColor blueColor];
You can do it in this way
Consider the img1 is the image which you get from URL. Here I have taken a bannerView, You can add the label and image into it.
UIImage *img1 = [UIImage imageNamed:@"Screen.png"]; UIView *vwBanner = [[UIView alloc] initWithFrame:CGRectMake(0, 0, img1.size.width, 60)]; vwBanner.backgroundColor = [UIColor grayColor]; UIView *vwWithBanner = [[UIView alloc] initWithFrame:CGRectMake(0, 0, img1.size.width, img1.size.height+vwBanner.frame.size.height)]; [vwWithBanner addSubview:vwBanner]; UIImageView *imgVw = [[UIImageView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(vwBanner.frame), img1.size.width, img1.size.height)]; imgVw.image = img1; [vwWithBanner addSubview:imgVw]; UIGraphicsBeginImageContextWithOptions(vwWithBanner.bounds.size, NO, img1.scale); [vwWithBanner drawViewHierarchyInRect:vwWithBanner.bounds afterScreenUpdates:YES]; // old style [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
See the gray bar is the Banner View and the below is the image. I did not have image so taken a screen shot of simulator to demonstrate the example.
Hope It helps
Happy Coding ...