Re: Odd behavior / appearance
Re: Odd behavior / appearance
- Subject: Re: Odd behavior / appearance
- From: Matt Neuburg <email@hidden>
- Date: Thu, 17 Feb 2011 08:10:23 -0800
I just got around to testing this and could not confirm your results; the alert sheet looked just fine, and looked and behaved the same way, under all circumstances you list (different showFromRect: values, different device orientations).
But there was one crucial difference between your code and mine - I summoned the action sheet using a button, not with your performSelector hack. I suspect that the hack is the cause of the problem. You must not use viewDidLoad, even with performSelector, to do things outside the view that just loaded. m.
On Thu, 23 Dec 2010 17:33:27 -0500, Phillip Mills <email@hidden> said:
>While attempting to use a UIActionSheet with dynamically added buttons, I seem to have discovered some oddities with how they work...or don't.
>
>I create a simple View-based application and add the following code:
>
>- (void)showMyActionSheet {
> UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Test Sheet" delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"Delete" otherButtonTitles:nil];
> for (int i = 1; i <= 14; i++) {
> [sheet addButtonWithTitle:[NSString stringWithFormat:@"Button %d", i]];
> }
> UIView *aView = [self view];
> [sheet showFromRect:CGRectMake(472.0, 233.0, 58.0, 29.0) inView:aView animated:YES];
> [sheet release];
>}
>
>- (void)viewDidLoad {
> [super viewDidLoad];
> [self performSelectorOnMainThread:@selector(showMyActionSheet) withObject:nil waitUntilDone:NO]; // Hack to avoid nil: 'viewDidLoad' isn't 'viewDidLoadCompletely'
>}
>
>If I run this in portrait orientation, I get a display of buttons up to "Button 12" with thick black lines between, a small amount of the next button, and no ability to scroll to the end of the list.
>
>If I run it landscape, the button style is different with thin dividing lines, scrolling is enabled, but the "Delete" button has only a small red section at the beginning instead of having an entirely red background. (I could live with this; it;s the portrait display that's a deal-breaker.)
>
>Another troubling variation comes from running landscape and replacing the 'showFromRect' line with:
>
> [sheet showFromRect:CGRectMake(472.0, 633.0, 58.0, 29.0) inView:aView animated:YES];
>
>In this case, I get the nicer, scrollable sheet...but it will not scroll far enough to leave the bottom two buttons on the screen (scrolls and bounces back).
>
>Solutions would be nice, of course, but I'm as much interested in whether someone can run a sanity check to see if they witness the same strangeness.
>
>
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________
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