不说话,直接上个例子,很简单哦
@interfaceViewController ()
@end
@implementation ViewController {
UIAlertController * actionSheet;
UIImageView *imageview;
}
- (void)viewDidLoad {
[superviewDidLoad];
UIButton *btn = [UIButtonbuttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(100, 220, 100, 40);
[btn setTitle:@"获取"forState:0];
[btn setTitleColor:[UIColor greenColor] forState:0];
[self.view addSubview:btn];
[btn addTarget:selfaction:@selector(BtnClick) forControlEvents:UIControlEventTouchUpInside];
actionSheet =[UIAlertControlleralertControllerWithTitle:@"选择图像"message:nilpreferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *num1=[UIAlertActionactionWithTitle:@"相册"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction * _Nonnull