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

  • Home
  • SEARCH
  • 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 6120419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:39:58+00:00 2026-05-23T15:39:58+00:00

I have such code: @interface Alert : UIView { } /* – (void) initWithTitle:(NSString*)title

  • 0

I have such code:

@interface Alert : UIView 
{

}
/*
- (void) initWithTitle:(NSString*)title message:(NSString*)message cancelButtonTitle:(NSString*)cancelButtonTitle otherButtonTitles:(NSString*)buttonTitle,... delegate:(id)delegate;
*/
@end


@implementation Alert

- (void) drawRect:(CGRect)rect 
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextClearRect(context, rect); // Очистим context

    CGContextSetRGBFillColor(context, 255, 0, 0, 1);
    CGContextFillRect(context, CGRectMake(20, 20, 100, 100));
}

- (void) show
{
    self.center = [[[UIApplication sharedApplication] keyWindow] center];
    [[[UIApplication sharedApplication] keyWindow] addSubview:self];
    [[[UIApplication sharedApplication] keyWindow] bringSubviewToFront:self];
}

Then I’m use it so:

- (void)viewDidLoad
{
    [super viewDidLoad];
     Alert * alert = [[Alert alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    [alert show];
    [alert release];
}

But it doesn’t work(I want to see Alert above all other views). Could you help me?

  • 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-23T15:39:59+00:00Added an answer on May 23, 2026 at 3:39 pm

    The recommended solutions which handle device orientation properly are

    • pod
      AGWindowView It will automatically deal with any rotation and framechanges so you won’t have to worry about that.

    • read and follow the official post https://developer.apple.com/library/content/qa/qa1688/_index.html

    • Add your view to the first subview, instead of adding it to the window

       UIWindow* window = [UIApplication sharedApplication].keyWindow;
       if (!window) 
           window = [[UIApplication sharedApplication].windows objectAtIndex:0];
       [[[window subviews] objectAtIndex:0] addSubview:myView];
      

    You can also add it to the window. It will not handle device orientation, though.

    let window = UIApplication.sharedApplication().keyWindow!
    let view = UIView(frame: CGRect(x: window.frame.origin.x, y: window.frame.origin.y, width: window.frame.width, height: window.frame.height))
    window.addSubview(view);
    view.backgroundColor = UIColor.blackColor()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have such piece of code: namespace NetHacking { interface IPlugin { void Execute(PluginData
We have a place in a code of such form: void processParam(Object param) {
So i have such code. public interface IGeoDataSet<out T> : IDataSet where T :
Let's say I have the following code: interface ISomeInterface { void DoSomething(); void A();
I have code internal interface IFoo { void foo(); } public class A :
I have such code: <h:inputText id=input value=#{bean.input}> <f:convertNumber /> <rich:ajaxValidator event=onblur /> </h:inputText> I
I have such code in my JSF template: <h:form> <table id=users cellspacing=0> <a4j:repeat var=person
i have such code var prj = _dataContext.Project.FirstOrDefault(p => p.isPopular == true); if (prj
I have such code: function allValid() { $('input').each(function(index) { if(something) { return false; }
For reference, the code is for the motorola 68008. Say I have code such

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.