开发者

Flirt two Views by TabBar

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 Fli开发者_运维知识库p between View1 and View2 in the Methods?


- (void)ShowENSSetting{
//assume    view1.tag=11;
    [UIView transitionWithView:self.view duration:2.0 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^(void) {

        if (![self.view viewWithTag:11]) {
            view1.tag=11;
            [self.view addSubview:view1];

        }

        else {
            [self.view bringSubviewToFront:[self.view viewWithTag:11]];
        }




    } completion:^(BOOL finished) {

        NSLog(@"ENSSetting active");

    }];




}


- (void)ShowGeneralSetting{

        //assume    view2.tag=22;

    [UIView transitionWithView:self.view duration:2.0 options:UIViewAnimationOptionTransitionFlipFromRight animations:^(void) {

        if (![self.view viewWithTag:22]) {
            view2.tag=22;               
            [self.view addSubview:view2];

        }

        else {
            [self.view bringSubviewToFront:[self.view viewWithTag:22]];
        }




    } completion:^(BOOL finished) {

        NSLog(@"GeneralSetting active");

    }];





}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜