2013-04-08 20 views
6

Wie kann ich einen Blick von unten bewegen auf meinem Code nach oben:UIView von unten nach oben

colorView.hidden=NO; 
colorView=[[UIView alloc]init]; 
colorView.frame=CGRectMake(0,480,320, 480); 
colorView.bounds=CGRectMake(0,200,320, 280); 
colorView.backgroundColor=[UIColor greenColor]; 
colorView.alpha=1.0f; 
[webView addSubview:colorView]; 
[self.view addSubview:webView]; 
[self createTransparentView]; 

So wie kann ich die Animation hier hinzufügen?

+0

Was hast du probiert? Welche Forschung haben Sie vor dem Stellen dieser Frage durchgeführt? – Sebivor

+0

Sie könnten CATransition auf Ansichtsschicht http://StackOverflow.com/A/23195924/1378447 –

Antwort

51

Zunächst fügen Sie Ihre Ansicht:

self.postStatusView.frame = CGRectMake(0, 490, 320, 460); 

Für die Animation von unten unten hinzufügen nach oben:

[UIView animateWithDuration:0.5 
         delay:0.1 
        options: UIViewAnimationOptionCurveEaseIn 
       animations:^{ 
        self.postStatusView.frame = CGRectMake(0, 0, 320, 460); 
       } 
       completion:^(BOOL finished){ 
       }]; 
[self.view addSubview:self.postStatusView]; 

Für die Ansicht Entfernen

[UIView animateWithDuration:1.5 
           delay:0.5 
          options: UIViewAnimationOptionCurveEaseIn 
         animations:^{ 
    self.postStatusView.frame = CGRectMake(0, 490, 320, 460); 
         } 
         completion:^(BOOL finished){ 
          if (finished) 
           [self.postStatusView removeFromSuperview]; 
         }]; 
+0

PostStatus ist Ihr Ansichtsname Ryt? – Naveen

+0

ja, das war mein Ansichtsname @naveen – Vinodh

+0

nice..it's arbeitete –

1
self.colorView.frame = CGRectMake(0, 490, 320, 460); 

[UIView animateWithDuration:0.5 
       delay:0.1 
       options: UIViewAnimationCurveEaseIn 
      animations:^{ 
       self.colorView.frame = CGRectMake(0, 0, 320, 460); 
      } 
      completion:^(BOOL finished){ 
      }]; 
[self.view addSubview:self.colorView]; 

[UIView animateWithDuration:1.5 
          delay:0.5 
         options: UIViewAnimationCurveEaseIn 
        animations:^{ 
self.colorView.frame = CGRectMake(0, 490, 320, 460); 
        } 
        completion:^(BOOL finished){ 
          [self.colorView removeFromSuperview]; 
        }]; 
+2

Anstatt nur etwas Code raus zu werfen, wäre es viel nützlicher zu erklären, was getan wird und warum, –

0
self.tableView.frame = CGRectMake(0, 490, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height); 

[UIView animateWithDuration:.35 
         delay:0.0 
        options: UIViewAnimationOptionCurveEaseInOut 
       animations:^{ 
        self.tableView.frame = CGRectMake(0, -20, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height); 
       } 
       completion:^(BOOL finished){ 
        [UIView animateWithDuration:0.1 delay:0.0 
         options: UIViewAnimationOptionCurveEaseInOut animations:^{ 

         self.tableView.frame = CGRectMake(0, 20, [[UIScreen mainScreen] bounds].size.width , [[UIScreen mainScreen] bounds].size.height); 

        } completion:^(BOOL finished){ 

         [UIView animateWithDuration:0.1 delay:0.0 
          options: UIViewAnimationOptionCurveEaseInOut animations:^{ 

           self.tableView.frame = CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height); 

         } completion:^(BOOL finished){ 

       }]; 
     }]; 
}]; 
Verwandte Themen