• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UIAlertView has zero bounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UIAlertView has zero bounds


  • Subject: UIAlertView has zero bounds
  • From: Michael Crawford <email@hidden>
  • Date: Sun, 19 Apr 2015 20:39:59 -0700

I have some code from Erica Sadun's "iPhone Developers Cookbook" that
used to work.  I do realize that UIAlertView is deprecated in iOS 8 -
but that means it should still be present, it hasn't gone away quite
yet.

What I want to accomplish is to prompt the use for a filename to save
a document in my iOS App's Documents folder; these documents could
later be exchanged with other people.  It's a standard interchange
format for Conway's Game of Life.

Perhaps I have discovered a bug in iOS.

I'm cool with adding the code for the new-style UIAlertController but
I want to make sure my code still works on older platforms.

I wrote a separate app with just one button that brings up a
UIAlertView.  In the production code I create a UITextField then
center it in the UIAlertView.

I only see one other mention of this in Google; this leads me to
suspect that it is my problem and not Apple's but then it shouldn't be
the case that an isolated app has the same behaviour.

Thanks -- Mike

  // ViewController.m
   - (IBAction) button: (id) sender
   {
       MyDelegate *myDelegate = [[MyDelegate alloc] initWithRunLoop:
                                                           CFRunLoopGetMain()];

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle: @"Question?"
                                                        message: @"Foo"
                                                       delegate: myDelegate
                                              cancelButtonTitle: @"Yes"
                                              otherButtonTitles: @"No", nil];

    //CGRect bounds = alertView.bounds;
    // NSLog( @"%f %f", bounds.size.width, bounds.size.height );

    [alertView show];

      CFRunLoopRun();

    return;
}

// MyDelegate.m
@implementation MyDelegate

- (id) initWithRunLoop: (CFRunLoopRef) theRunLoop
{
    runLoop = theRunLoop;

    return self;
}

- (void) willPresentAlertView: (UIAlertView *) alertView
{
    CGRect bounds = alertView.bounds;
    NSLog( @"%f %f", bounds.size.width, bounds.size.height );

    return;
}

Michael David Crawford, Consulting Software Engineer
email@hidden
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: UIAlertView has zero bounds
      • From: Roland King <email@hidden>
  • Prev by Date: Re: No sound through speaker
  • Next by Date: Re: Thousands of leaked CGContext ?
  • Previous by thread: MKMapView maximum zoom?
  • Next by thread: Re: UIAlertView has zero bounds
  • Index(es):
    • Date
    • Thread