Showing posts with label actionsheet. Show all posts
Showing posts with label actionsheet. Show all posts
UIActionSheet Dynamic Button
UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"Dynamic"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
if(buttonX)
{
[actionSheet addButtonWithTitle:@"Button X"];
}
if(buttonY)
{
[actionSheet addButtonWithTitle:@"Button Y"];
}
if(buttonZ)
{
[actionSheet addButtonWithTitle:@"Button Z"];
}
[actionSheet addButtonWithTitle:@"Cancel"];
actionSheet.cancelButtonIndex = actionSheet.numberOfButtons - 1;
Labels:
actionsheet,
iphone SDK
Disable or Hide Button in UIActionSheet
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Share"
delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
otherButtonTitles:@"Send Message (SMS)", @"Send E-Mail", @"Print", @"Twitter", nil];
[actionSheet showInView:self.view];
for(UIView *v in [actionSheet subviews])
{
if([[v description] hasPrefix: @"<UIThreePartButton"] )
{
if ([v respondsToSelector:@selector(title)])
{
NSString* title = [v performSelector:@selector(title)];
if ([title isEqualToString:@"Twitter"])
{
//v.hidden = YES;
((UIButton*)v).enabled = NO;
}
}
}
}
[actionSheet release];
Labels:
actionsheet,
iphone SDK
Subscribe to:
Posts (Atom)