从评论中更新:
你为我工作。犯了一个愚蠢的错误:-(在viewDidLoad中,我正在为delete按钮而不是showDeleteActionSheet调用一个backAction方法。这就是为什么它引起了这样的麻烦。非常感谢
我有一个UIScrollView,它添加了多个UIViews。我想通过使用UIScrollView删除UIActionSheet中的一个特定视图。但这不管用..。
.h file
-------
@interface myScrollViewController : UIViewController <UIScrollViewDelegate,UIActionSheetDelegate>
{
UIScrollView *holdSlideScrollView;
UIImageView *editPaperView;
}
@property (nonatomic, strong) UIScrollView *holdSlideScrollView;
@property (nonatomic, strong) UIScrollView *holdSlideScrollView;
- (void) showDeleteActionSheet;
@end
.m file
———
@implementation SlideViewController
- (void) loadView
{
[super loadView];
for (int i= 0; i < 2; i++)
{
UIImageView *editPaperView = [[UIImageView alloc] initWithFrame:CGRectMake(6.0f+i*320, 4.0f, 307.0f, 409.0f)];
[editPaperView setImage:[UIImage imageNamed:@"paper.png"]];
editPaperView.userInteractionEnabled = YES;
editPaperView.tag = i;
UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
[deleteButton setAlpha:0.8f];
[deleteButton setFrame:CGRectMake(265.0f, 378.0f, 30.0f, 30.0f)];
[deleteButton setImage:[UIImage imageNamed:@"ps_delete.png"] forState:UIControlStateNormal];
//[deleteButton setImage:[UIImage imageNamed:@“delete_bplushigh.png"] forState:UIControlStateHighlighted];
[deleteButton addTarget:self action:@selector(showDeleteActionSheet) forControlEvents:UIControlEventTouchUpInside];
[editPaperView addSubview:deleteButton];
[holdSlideScrollView addSubview:editPaperView];
}
[self.view addSubview:holdSlideScrollView];
}
- (void) showDeleteActionSheet
{
UIActionSheet *popupDeleteActionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:nil];
popupDeleteActionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupDeleteActionSheet showInView:self.view];
//popupDeleteActionSheet = nil;
}
@end这有什么问题吗?请帮帮我!
发布于 2012-08-17 14:48:36
如果在UIActionSheet+UIScrollView中添加UIActionSheet,似乎self.view总是一个问题。
试试这。它对我有效..。
https://stackoverflow.com/questions/11226438
复制相似问题