How to customize UIActionSheet? iOS

后端 未结 7 1313
小蘑菇
小蘑菇 2020-12-04 12:38

Is it possible to create an ActionSheet that have a label between two buttons like this image?

\"ent

7条回答
  •  庸人自扰
    2020-12-04 13:31

    UIButton* button = (UIButton*)sender;
        actionSheet = [[UIActionSheet alloc] initWithTitle:@"Share the PNR Status" delegate:self
                                         cancelButtonTitle:@"Cancel"
                                    destructiveButtonTitle:nil
                                         otherButtonTitles:@"Send Message",@"Send Email",@"Facebook",nil];
    
        [[[actionSheet valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"chat.png"] forState:UIControlStateNormal];
        [[[actionSheet valueForKey:@"_buttons"] objectAtIndex:1] setImage:[UIImage imageNamed:@"email.png"] forState:UIControlStateNormal];
        [[[actionSheet valueForKey:@"_buttons"] objectAtIndex:2] setImage:[UIImage imageNamed:@"facebook_black.png"] forState:UIControlStateNormal];
     //*********** Cancel
        [[[actionSheet valueForKey:@"_buttons"] objectAtIndex:3] setImage:[UIImage imageNamed:@"cancel.png"] forState:UIControlStateNormal];
        [actionSheet showFromRect:button.frame inView:self.view animated:YES];
    

提交回复
热议问题