adding view into action sheet

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

Can I add my custom UIViewController into the ActionSheet ?

thanks

相关标签:
3条回答
  • 2021-01-06 19:52

    i think these links will help u. i have never add a view in uiactionsheet but after a little search i think we can add.

    http://www.ifans.com/forums/showthread.php?t=301851

    how add the action sheet in the cell of table view

    0 讨论(0)
  • 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)];  
    
    0 讨论(0)
  • 2021-01-06 20:02

    finally I've find it... I've added a view which is subclass of UIViewController into the UIActionSheet. I've created a view in separate file (using xib) .

    UIActionSheet *asheet = [[UIActionSheet alloc] init];
    [asheet showInView:self.view]; 
    [asheet setFrame:CGRectMake(0, 230, 320, 230)];
    
    
    CustomView *innerView = [[CustomView alloc] initWithNibName:@"CustomView" bundle:nil];
    innerView.view.frame = CGRectMake(0, 10, 320, 210);
    [asheet addSubview:innerView.view];
    //[asheet addSubview:innerView];
    
    [innerView release];
    [asheet release];
    
    0 讨论(0)
提交回复
热议问题