- (void)willPresentActionSheet:(UIActionSheet *)actionSheet // before animation and showing view
{
//To Grayed out Cancel button if there is no loaded image
for (UIView* view in [actionSheet subviews])
{
if ([[[view class] description] isEqualToString:@"UIAlertButton"])
{
if ([view respondsToSelector:@selector(title)])
{
NSString* title = [view performSelector:@selector(title)];
if ([title isEqualToString:@"Cancel"] && [view respondsToSelector:@selector(setEnabled:)])
{
if(imageView.image == nil)
{
view.backgroundColor = [UIColor grayColor];
view.alpha = 0.5;
}
}
}
}
}
}
http://stackoverflow.com/questions/743636/iphone-disabling-uiactionsheet-buttons
No comments:
Post a Comment