0

我想在我的应用程序中使用 BCGenieEffect。我从 github 下载演示示例。 https://github.com/Ciechan/BCGenieEffect

在这个例子中使用了 xib,并且 4 个 UIButtons 与 xib 一起使用。我想在没有 xib 的情况下使用此代码,并且仅用于一个按钮。我不想拖动我的视图,这就是我删除该代码的原因。

我有一个 UIButton:

UIButton *Pop_Hidebtn = [[UIButton alloc]initWithFrame:CGRectMake(290, 5, 15, 15)];
Pop_Hidebtn.backgroundColor = [UIColor clearColor];
[Pop_Hidebtn setImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateNormal];

Pop_Hidebtn.titleLabel.textColor = [UIColor blueColor];
[Pop_Hidebtn addTarget:self action:@selector(Hidden_pop:) forControlEvents:UIControlEventTouchUpInside];  
[popup_View addSubview:Pop_Hidebtn];


-(void)Hidden_pop:(UIButton *)sender{

[self genieToRect:sender.frame edge:BCRectEdgeBottom];
}


// I modified this and it says-> UIButton may not respond to enumerateobjectsusingblock


- (void) genieToRect: (CGRect)rect edge: (BCRectEdge) edge
{
NSTimeInterval duration = 3.0;

CGRect endRect = CGRectInset(rect, 5.0, 5.0);

[help_Button enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL   *stop)     
{ 
help_Button.enabled = NO;
}];


if (self.viewIsIn) {

[popup_View_under2 genieOutTransitionWithDuration:duration startRect:endRect     startEdge:edge completion:^{
popup_View_under2.userInteractionEnabled = YES;

[help_Button enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx,  BOOL  *stop) {
help_Button.enabled = YES;

}];
}];
} else {
popup_View_under2.userInteractionEnabled = NO;
[popup_View_under2 genieInTransitionWithDuration:duration destinationRect:endRect   destinationEdge:edge completion:
^{
[help_Button enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx,  BOOL  *stop) {
button.enabled = YES;
}];}];
}
self.viewIsIn = ! self.viewIsIn;
}

如何解决这个问题呢?

4

1 回答 1

0

由于您在示例中只使用了一个按钮而不是四个按钮,因此您不需要enumerateObjectsUsingBlockhelp_Button,就help_Button.enabled = YES;可以了。

于 2013-01-29T14:45:12.807 回答