0
![我在幾個應用程序中看到過這個功能。例如Facebook應用程序有一個按鈕,當按下時,主視圖向右滑動並顯示輔助視圖。第二個視圖有一個用戶可以點擊的項目列表。這個叫什麼。我認爲這只是一個視圖頂部的滾動視圖,但是當我運行我的應用程序時,第二個視圖不顯示。Xcode中隱藏的表格
.H
#import <UIKit/UIKit.h>
@interface PartsViewController : UIViewController {
IBOutlet UIScrollView *mainScroll;
}
.M
- (void)viewDidLoad
{
[mainScroll setScrollEnabled:YES];
[mainScroll setContentSize:CGSizeMake(400, 500)];
}
就像我說這沒有表現出第二種觀點。不知道我是否需要滑動手勢。我相信我需要一個按鈕的動作。
好吧,這是我如何創建我的滑動菜單。
.H @interface ViewController中:UIViewController中{
IBOutlet UIButton *main;
IBOutlet UIButton *parts;
IBOutlet UIButton *project;
IBOutlet UIButton *misc;
IBOutlet UIButton *close;
IBOutlet UIScrollView *ButtonScrollView;
}
- (IBAction)showButtonScroll:(id)sender;
- (IBAction)hideButtonScroll:(id)sender;
@end
.M
- (void)viewDidLoad {
[super viewDidLoad];
//Button Scroll View
ButtonScrollView.frame = CGRectMake(767, 75,391 , 940);
}
- (IBAction)showButtonScroll:(id)sender {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
ButtonScrollView.frame = CGRectMake(377, 75, 391, 940);
[UIView commitAnimations];
}
- (IBAction)hideButtonScroll:(id)sender {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
ButtonScrollView.frame = CGRectMake(767, 75, 391, 940);
[UIView commitAnimations];
}
由於它是一個滾動視圖,我可以添加我想要的任何物品,並將其放置在那裏我曾經想過。希望這可以幫助。