0
正如您在截圖中看到的,我在IB中添加了一個UIView(名爲SearchView)來控制我的代碼。如何在代碼中控制UIView
http://i.stack.imgur.com/cIs3e.png
我如何可以加載的UIView在我的代碼編程?
謝謝。
正如您在截圖中看到的,我在IB中添加了一個UIView(名爲SearchView)來控制我的代碼。如何在代碼中控制UIView
http://i.stack.imgur.com/cIs3e.png
我如何可以加載的UIView在我的代碼編程?
謝謝。
FlipView方法加載的UIView編程
在.h文件中使用此代碼
@interface MainViewController : UIViewController {
IBOutlet UIView *secondaryView;
}
- (IBAction)toggleView:(id)sender; //Action for toggle view
- (IBAction)returnView:(id)sender;
@end
在.M
- (IBAction)toggleView:(id)sender {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:[self view]
cache:YES];
[[self view] addSubview:secondaryView];
[UIView commitAnimations];
}
//Flips to front when "Done" is pressed
- (IBAction)returnView:(id)sender {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:[self view]
cache:YES];
[secondaryView removeFromSuperview];
[UIView commitAnimations];
}
您可以檢查此教程http://www.vimeo.com/5653713如果任何混淆。