我在Buttom有一个Uibutton。当用户点击该按钮时,uiview动画显示为从buttom到up的弹出窗口。 这是我的代码
-(void)viewDidLoad
{
[super viewDidLoad];
self.BuyButtonPopUpView.frame = CGRectMake(self.BuyButtonPopUpView.frame.origin.x, 1000, self.BuyButtonPopUpView.frame.size.width,self.BuyButtonPopUpView.frame.size.height);
}
- (IBAction)animated:(id)sender
{
if(_isAnimated)
{
[UIView animateWithDuration:0.3
delay:0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
self.BuyButtonPopUpView.frame = CGRectMake(self.BuyButtonPopUpView.frame.origin.x, 520, self.BuyButtonPopUpView.frame.size.width,self.BuyButtonPopUpView.frame.size.height);
}
completion:^(BOOL finished){
}];
_isAnimated=NO;
}
else
{
[UIView animateWithDuration:0.3
delay:0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
self.BuyButtonPopUpView.frame = CGRectMake(self.BuyButtonPopUpView.frame.origin.x, 1000, self.BuyButtonPopUpView.frame.size.width,self.BuyButtonPopUpView.frame.size.height);
}
completion:^(BOOL finished)
{
}];
_isAnimated=YES;
}
}
Uiview动画完美无缺,但是当uiview出现时,背景视图会像uiactionsheet一样创建阴影(或模糊),并且在完成动画背景视图后很清楚。
我不知道如何实施。
请帮助我
我是ios的新人...
答案 0 :(得分:1)
您可以在后台添加UIView
,并在故事板中设置其backgroundcolor
黑色和alpha
0.5。然后使用动画将其alpha
从0.5更改为0。您还可以添加UITapGestureRecognizer
来检测其上的点击,并在用户点击外部时关闭该视图。
-(void)viewDidLoad
{
[super viewDidLoad];
self.BuyButtonPopUpView.frame = CGRectMake(self.BuyButtonPopUpView.frame.origin.x, 1000, self.BuyButtonPopUpView.frame.size.width,self.BuyButtonPopUpView.frame.size.height);
}
- (IBAction)animated:(id)sender
{
if(_isAnimated)
{
[UIView animateWithDuration:0.3
delay:0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
self.BuyButtonPopUpView.frame = CGRectMake(self.BuyButtonPopUpView.frame.origin.x, 520, self.BuyButtonPopUpView.frame.size.width,self.BuyButtonPopUpView.frame.size.height);
//showing background view here
self.viewBackground.alpha = 0.5;
}
completion:^(BOOL finished){
}];
_isAnimated=NO;
}
else
{
[UIView animateWithDuration:0.3
delay:0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
self.BuyButtonPopUpView.frame = CGRectMake(self.BuyButtonPopUpView.frame.origin.x, 1000, self.BuyButtonPopUpView.frame.size.width,self.BuyButtonPopUpView.frame.size.height);
//dismissing background view here
self.viewBackground.alpha = 0.0;
}
completion:^(BOOL finished)
{
}];
_isAnimated=YES;
}
}
用于检测外部的水龙头并取消您的观点:
创建UITapGestureRecognizer
:
@interface ViewController ()
{
UITapGestureRecognizer *tapGesture;
}
在ViewDidLoad
中初始化:
-(void)viewDidLoad
{
//defining your gesture method
tapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleSingleTapGesture:)];
//adding gesture recognizer on the background view
[self.backgroundView addGestureRecognizer:tapGestureRecognizer];
}
在您的手势识别器方法中:
-(void)handleSingleTapGesture:(UITapGestureRecognizer *)tapGestureRecognizer
{
[UIView animateWithDuration:0.3
animations:^{
//dismissing background view here
self.viewBackground.alpha = 0.0;
}
completion:^(BOOL finished){
}];
}
希望这有帮助。
答案 1 :(得分:0)
在viewdidload.add QuartzCore框架中添加你的代码
class2.java
static
{
UMRMetadataSupportDAOImpl d=new UMRMetadataSupportDAOImpl();
listDocuments= d.getDocumentationList(); //error here
for (UMRDocumentationDTO listDoc: listDocuments)
{
if(listDoc.equals(MMTConstantsInt.DOMAIN_NAME))
domainDocumentationMap.put(listDoc.getId().getObjectName(), listDoc.getDocumentationLink());
else
domainComboDocumentationMap.put(listDoc.getId().getObjectName(), listDoc.getDocumentationLink());
}
答案 2 :(得分:0)
您可以先添加UIVisualEffectView,然后在此视图上添加弹出窗口。
这是一个教程链接https://www.raywenderlich.com/84043/ios-8-visual-effects-tutorial