Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7405671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:26:20+00:00 2026-05-29T05:26:20+00:00

I have a frame on my UIView with a layer. I have the layer

  • 0

I have a frame on my UIView with a layer. I have the layer set the background color and make the alpha 0.5 and make the frame.backgroundColor = clearColor so that people can see the lines behind it. However it makes the subviews which hold text also faded out. How do I prevent this?

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self setAlpha:kAlpha];
        CALayer *layer = [self layer];
        [layer setMasksToBounds:YES];
        [layer setBackgroundColor:[UIColor redColor].CGColor];
        [layer setCornerRadius:kCornerRadius];
    }
    return self;
}

- (id)init
{
    if (self = [super init]) {
        self.clipsToBounds = YES;
        self.userInteractionEnabled = YES;
        self.multipleTouchEnabled = NO;

        tileTitle = [[UILabel alloc] init];
        tileTitle.textColor = [UIColor blackColor];
        tileTitle.backgroundColor = [UIColor clearColor];
        tileTitle.font = [UIFont boldSystemFontOfSize:13.0f];

        tileDescription = [[UILabel alloc] init];
        tileDescription.textColor = [UIColor blackColor];
        tileDescription.backgroundColor = [UIColor clearColor];
        tileDescription.font = [UIFont systemFontOfSize:11.0f];
        tileDescription.lineBreakMode = UILineBreakModeTailTruncation;

        [self addSubview:tileTitle];
        [self addSubview:tileDescription];
    }

    return self;
}

Screenshot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:26:21+00:00Added an answer on May 29, 2026 at 5:26 am

    To change the transparency of the view, but not its subviews, you can change its background color:

    myView.backgroundColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.25];
    

    This method also works with a CALayer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom UIView that generates a set of subviews and display them
I have a frame that once it's minimized, I'd like to minimize other frames
Do older iPods and iPhones have a frame rate of 60fps? I'm finding that
I was just wondering about something. I have a frame that loads pages and
I am using CATiledLayer as backing layer for my UIView, which I have put
I am updating some old code and I have a subclassed UIView (GraphView) that
I have a view with a certain background color. I am masking this view
I have a UIView subclass that I am doing some custom drawing in. When
I have a UIView class that I am using to have a CALayer. This
I have a UIViewController that is initialised with a correct frame, however somewhere in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.