1

i have a UIImageView .i want to add a trans

 inCallBackGroundImgae = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"caller_texture.png"]];
        [inCallBackGroundImgae setFrame:CGRectMake(0,top, self.view.frame.size.width, 250)];
        [self.view addSubview: inCallBackGroundImgae];

enter image description here

i want to add a transparent view, where i add a red colour enter image description here .i don,t want navigation bar i want to add a transparent view

Thanks in advance

Ferrakkem Bhuiyan
  • 2,741
  • 2
  • 22
  • 38

2 Answers2

0

Please do this one

UIView *transView = [[UIView alloc] initWithFrame:CGRectMake(0,0, self.view.frame.size.width, 50)];// set your height here what ever you wanna.
    transView.alpha = 0.5f;// set your alpha how much you wanna transparent.
[inCallBackGroundImgae addSubview: transView];
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
0

Firstly hide navigation bar like this in viewDidLoad method

[self.navigationController.navigationBar setHidden:YES];

Now add your transparent UIView in place of navigationBar

UIView *transparentView = [[UIView alloc] initWithFrame:CGRectMake(0,0, self.view.frame.size.width, 64)];
transparentView.alpha = 0.33f;
[self.view addSubview: transparentView];

EDIT : Adjust your image view frame as transparent view will not be seen.

CGRect imgViewRect = inCallBackGroundImgae.frame;
imgViewRect.origin.y = 64;
imgViewRect.size.height = decrease height here if necessary
inCallBackGroundImgae.frame = imgViewRect;
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132