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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:34:02+00:00 2026-06-09T10:34:02+00:00

Im creating a custom ui alert view. All works ok except any background image

  • 0

Im creating a custom ui alert view. All works ok except any background image that is used for the custom alert has the standard blue overlay over the top of it. Anyway I can get rid of this?

(the telephone is the backgroundImage for the alert view)

enter image description here

.m of custom class

     @synthesize backgroundImage, alertText;

 - (id)initWithImage:(UIImage *)image text:(NSString *)text {
 if (self = [super init]) {
    alertTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    alertTextLabel.textColor = [UIColor whiteColor];
    alertTextLabel.backgroundColor = [UIColor clearColor];
    alertTextLabel.font = [UIFont boldSystemFontOfSize:28.0];
    [self addSubview:alertTextLabel];

    self.backgroundImage = image;
    self.alertText = text;
   }
 return self;
 }

 - (void) setAlertText:(NSString *)text {
alertTextLabel.text = text;
}

- (NSString *) alertText {
return alertTextLabel.text;
}


- (void)drawRect:(CGRect)rect {
//CGContextRef ctx = UIGraphicsGetCurrentContext();

CGSize imageSize = self.backgroundImage.size;
//CGContextDrawImage(ctx, CGRectMake(0, 0, imageSize.width, imageSize.height),    self.backgroundImage.CGImage);
[self.backgroundImage drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)];
 }

 - (void) layoutSubviews {
alertTextLabel.transform = CGAffineTransformIdentity;
[alertTextLabel sizeToFit];

CGRect textRect = alertTextLabel.frame;
textRect.origin.x = (CGRectGetWidth(self.bounds) - CGRectGetWidth(textRect)) / 2;
textRect.origin.y = (CGRectGetHeight(self.bounds) - CGRectGetHeight(textRect)) / 2;
textRect.origin.y -= 0.0;

alertTextLabel.frame = textRect;

alertTextLabel.transform = CGAffineTransformMakeRotation(- M_PI * .08);
}

- (void) show {
[super show];

CGSize imageSize = self.backgroundImage.size;
self.bounds = CGRectMake(0, 0, imageSize.width, imageSize.height);
}

Called in my Viewcontroller for the alert

IBAction:

 UIImage *backgroundImage = [UIImage imageNamed:@"Telephone.png"];
alert = [[JKCustomAlert alloc] initWithImage:backgroundImage     text:NSLocalizedString(@"Title", nil)];
[alert show];


[self performSelector:@selector(hideAlert) withObject:nil afterDelay:4.0];
  • 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-06-09T10:34:04+00:00Added an answer on June 9, 2026 at 10:34 am

    AS per the ios documentation

    Subclassing Notes

    The UIAlertView class is intended to be used as-is and does not
    support subclassing. The view hierarchy for this class is private and
    must not be modified.

    http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIAlertView_Class/UIAlertView/UIAlertView.html

    This is probably why you are having trouble modifying the background.

    Anyways, What you are looking to do is a simple custom view. Make your own customized view and make it behave like an alert view yourself.

    It is very easy.

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

Sidebar

Related Questions

I'm creating custom UINavigationItem with custom background image and title. The image is shown
I'm looking for tutorials on creating custom view transitions. In particular, transitions that involve
I m Creating a custom alertview With Background image and one button (to dismiss
I'm looking for a tutorial that explains creating custom usercontrols in WPF. I want
I'm creating custom table view cells, but result is incorrect. My code: - (UITableViewCell
I am creating custom Swing components and want to provide a UI that looks
I'm creating custom control that contain multiple parts. Inside template creation I'm subscribing for
I have a Rails blog using friendly_id for creating custom urls. The blog has
Creating custom IHttpModules, I have realized that the requests for static files (e.g.: .css
i'm creating custom title for activity by disabling standard one and managing everything myself.

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.