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 3229252
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:47:21+00:00 2026-05-17T16:47:21+00:00

Hello I’d like to achieve at the same time rounded corners and a background

  • 0

Hello I’d like to achieve at the same time rounded corners and a background composed by tiling a little png (OPERATOR_VIEW_BACKGROUND_IMAGE). My main goal is to allow a designer to fill the background of a View by inserting the right image in the project resources.

[triggerView setFrame:CGRectMake(0, 0, ICONS_WIDTH, iconFrameHeight)];
[triggerView.layer setCornerRadius:borderRadius];
[triggerView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:OPERATOR_VIEW_BACKGROUND_IMAGE]]];;

I don’t know why but triggerView loose the CornerRadius setting when I add the last line.
triggerView is a UIView built with interface builder and modified in its superView viewDidLoad programmatically, with the code above.

Where I’m wrong?

EDIT: I haven’t mentioned that If I use a simple UIColor like: [UIColor orangeColor] It works well. So It’s something related to the patternImage thing.

EDIT: I’ve tried also this code, working on the layer background of my view:

[triggerView setFrame:CGRectMake(0, 0, ICONS_WIDTH, iconFrameHeight)];
triggerView.backgroundColor = [UIColor clearColor];
UIImage *img = [UIImage imageNamed:OPERATOR_VIEW_BACKGROUND_IMAGE];
triggerView.layer.backgroundColor = [UIColor colorWithPatternImage:img].CGColor;
triggerView.layer.cornerRadius = radius;
[img release];
[self.view addSubview:triggerView];

Now I get a transparent background but the corners are rounded;

  • 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-17T16:47:21+00:00Added an answer on May 17, 2026 at 4:47 pm

    Try setting the content property of the layer with the CGImageRef of the image:

    triggerView.layer.contents = (id) [[UIImage imageNamed:OPERATOR_VIEW_BACKGROUND_IMAGE] CGImage];
    

    You may have to alloc or retain the UIImage to prevent it being autoreleased…

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

Sidebar

Related Questions

Hello! I've been programming for a long time but just started developing for android,
Hello ! I need to create a report like the attachment shows with Jasper
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
Hello StackOverflow, I'd like to know if there is way to trigger an event
Hello,I'd like to ask you two questions. (I am using java and jedis) I
Hello guys i have set background image on my input text and text area
hello everyone I am newto programming and I am just a little bit confused.
Hello I was writing a Regular Expression (first time in my life I might
Hello everybody i have asp.net mvc4 application where i made countdown something like this:
Hello, I have a short question. I would like to reset a variable that

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.