adding view into action sheet

前端 未结 3 1564
-上瘾入骨i
-上瘾入骨i 2021-01-06 19:30

Can I add my custom UIViewController into the ActionSheet ?

thanks

3条回答
  •  无人及你
    2021-01-06 19:58

    I recently created an application where I created action sheet and added a picker view in it.
    Firstly you need to create object for action sheet in your .h file as along with its properties as follows :

    UIActionSheet *menuProperty;    
    
    @property(nonatomic,retain) UIActionSheet *menuArea;  
    

    Then you need to make following changes in your .m file

    menuArea = [[UIActionSheet alloc] initWithTitle:nil  delegate:self
                                                cancelButtonTitle:@"Done"  
                                            destructiveButtonTitle:nil
                                                 otherButtonTitles:nil];  
    
    
    // Add the picker  
    pickerArea = [[UIPickerView alloc] initWithFrame:CGRectMake(0,185,0,0)];  
    
    pickerArea.delegate = self;  
    pickerArea.showsSelectionIndicator = YES;    // note this is default to NO  
    
    [menuArea addSubview:pickerArea];  
    [menuArea showInView:self.view];  
    [menuArea setBounds:CGRectMake(0,0,320, 600)];  
    

提交回复
热议问题