相关疑难解决方法(0)

如何自动解除UIActionSheet

我有一个要求我在哪里显示actionSheet但是如果用户没有通过选择其中一个选项来关闭此操作表,我想通过程序在特定事件上自动关闭它.任何想法的人,我怎么能逐步解雇这个动作表?

iphone iphone-sdk-3.0

12
推荐指数
1
解决办法
7786
查看次数

如何使用关闭按钮关闭UIActionSheet并避免崩溃?

我已阅读另一篇文章(如何解散行动表),我可以使用

[actionSheet dismissWithClickedButtonIndex:0 animated:YES];
Run Code Online (Sandbox Code Playgroud)

使用关闭按钮关闭uiactionsheet,如下所述:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil 
                                                         delegate:nil
                                                cancelButtonTitle:nil
                                           destructiveButtonTitle:nil
                                                otherButtonTitles:nil];

[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];

CGRect pickerFrame = CGRectMake(0, 40, 0, 0);

UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:pickerFrame];
pickerView.showsSelectionIndicator = YES;
pickerView.dataSource = self;
pickerView.delegate = self;


[actionSheet addSubview:pickerView];
[pickerView release];

UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Close"]];
closeButton.momentary = YES; 
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];


[actionSheet dismissWithClickedButtonIndex:0 animated:YES];


[closeButton release];


[actionSheet …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c uisegmentedcontrol uipickerview uiactionsheet

6
推荐指数
1
解决办法
1万
查看次数