ActionSheet的用法

- (void)actionSheet {
    UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    
    UIAlertAction *showAllInfoAction = [UIAlertAction actionWithTitle:@"發出的紅包" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        _type = 2;
        [_headerView reloadTitleByType:_type];
        [self updateData];
    }];
    UIAlertAction *pickAction = [UIAlertAction actionWithTitle:@"收到的紅包" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        _type = 1;
        [_headerView reloadTitleByType:_type];
        [self updateData];
    }];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [actionSheetController addAction:cancelAction];
    [actionSheetController addAction:showAllInfoAction];
    [actionSheetController addAction:pickAction];
    
    [self presentViewController:actionSheetController animated:YES completion:nil];
}
相關文章
相關標籤/搜索