通过 TabBar 调情两个视图
这是我的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIBarButtonItem *newButton = [[UIBarButtonItem alloc]
initWithTitle:@"Speichern"
style:UIBarButtonItemStylePlain target:self
action:@selector(SaveSettings)];
self.navigationItem.rightBarButtonItem = newButton;
[newButton release];
ensStyleControl.selectedSegmentIndex = [SettingsHandler GetENSStyle];
UITabBar *tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 376, 320, 44)];
UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"Allgemein" image:[UIImage imageNamed:@"crops.png"] tag:0];
UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"ENS" image:[UIImage imageNamed:@"crops.png"] tag:1];
[item1 performSelectorOnMainThread:@selector(ShowGeneralSetting) withObject:nil waitUntilDone:NO];
[item2 performSelectorOnMainThread:@selector(ShowENSSetting) withObject:nil waitUntilDone:NO];
NSArray *items = [NSArray arrayWithObjects:item1,item2, nil];
[tabBar setItems:items animated:YES];
[tabBar setSelectedItem:nil];
tabBar.delegate=self;
[self.view addSubview:tabBar];
}
- (void)ShowENSSetting
{
//Show View1
}
- (void)ShowGeneralSetting
{
//Show View2
}
如何在方法中在 View1 和 View2 之间翻转?
this is my code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIBarButtonItem *newButton = [[UIBarButtonItem alloc]
initWithTitle:@"Speichern"
style:UIBarButtonItemStylePlain target:self
action:@selector(SaveSettings)];
self.navigationItem.rightBarButtonItem = newButton;
[newButton release];
ensStyleControl.selectedSegmentIndex = [SettingsHandler GetENSStyle];
UITabBar *tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 376, 320, 44)];
UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"Allgemein" image:[UIImage imageNamed:@"crops.png"] tag:0];
UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"ENS" image:[UIImage imageNamed:@"crops.png"] tag:1];
[item1 performSelectorOnMainThread:@selector(ShowGeneralSetting) withObject:nil waitUntilDone:NO];
[item2 performSelectorOnMainThread:@selector(ShowENSSetting) withObject:nil waitUntilDone:NO];
NSArray *items = [NSArray arrayWithObjects:item1,item2, nil];
[tabBar setItems:items animated:YES];
[tabBar setSelectedItem:nil];
tabBar.delegate=self;
[self.view addSubview:tabBar];
}
- (void)ShowENSSetting
{
//Show View1
}
- (void)ShowGeneralSetting
{
//Show View2
}
How to Flip between View1 and View2 in the Methods?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)