简体   繁体   中英

Remove background of UIVIew - Remove The rectangle like shape

I have a UIView in which i want to remove the whole background so it would take the shape of a paper. I tried setting the background to transparent from the UI and using the code but i always end up with a gray-like semi transparent background no matter what i do. Here is the current output i am getting : 在此处输入图片说明

How can i remove that grey background? i need it to display as a whole paper without that residue. Any Help? I tried the following :

//     self.view.backgroundColor = [UIColor clearColor];
//
//     [self.view setOpaque:YES];
//     
   //  self.view.backgroundColor = [UIColor clearColor];.
   //  self.view.layer.borderWidth = 0.0;
    // self.view.layer.masksToBounds = YES;
  //   self.view.backgroundColor=[[UIColor clearColor] colorWithAlphaComponent:.0];

And the current UI Configuration is :
在此处输入图片说明

How can i manage to remove it !? Any help!?

EDIT 1 This is the new output 在此处输入图片说明

Looks like your image it's inside a Modal View. If that is the case try the following:

Set the self.view.superview.backgroundColor to [UIColor clearColor]; inside the viewWillLayoutSubviews

Example

- (void)viewWillLayoutSubviews
{

    [super viewWillLayoutSubviews];
     self.view.superview.layer.masksToBounds = YES;
     self.view.superview.backgroundColor = [UIColor clearColor];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM