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._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to