在没有导航的情况下在ipad应用程序中单击按钮打开视图(另一个xib)

时间:2012-05-08 05:01:17

标签: iphone ios ipad

在视图上有一个图像图标,点击图标另一个视图(其他xib)只是打开,就像键盘打开一样,它应该只覆盖屏幕底部30%,点击任何图标时有五个图标当前的图标应该替换为所选的icon.it是一个ipad apps.thanks to all。

4 个答案:

答案 0 :(得分:1)

 [self.view addSubview:youranotherviewcontroller.view];

[self presentModalViewController:youranotherviewcontroller animated:NO];

我建议你阅读以下苹果指南。它可能对你有所帮助。

About View Controllers

希望,这会对你有所帮助

答案 1 :(得分:1)

ViewController *viewController=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
viewController.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;//any type you want use that
[self presentModalViewController:viewController animated:YES];

我认为这行代码对您有所帮助,只是尝试告诉我这样看你的应用程序。

答案 2 :(得分:1)

你可以使用模态视图方法来提升你的滑动效果,或者你可以添加动画的同胞视图,你可以用这个来检查 -

UIView *myAnimationView = [[UIView alloc] initWithFrame:self.view.frame];
myAnimationView.backgroundColor = [UIColor blueColor];
[self.view addSubview:myAnimationView];

[myAnimationView setFrame:CGRectMake(0, 480, 320, 480)];
[myAnimationView setBounds:CGRectMake(0, 0, 320, 480)];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationDelegate:self];
[myAnimationView setFrame:CGRectMake(0, 0, 320, 480)];
[UIView commitAnimations];

答案 3 :(得分:1)

使用此: - 在ViewDidLoad中同样给出youranotherviewcontroller的帧大小,使其仅覆盖屏幕的30%。之后: -

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{
    UITouch *touch = [[event allTouches] anyObject]; 

    CGPoint startLocation = [touch locationInView:self.view];
    if([touch view]==yourFirstImageIcon)
    {
        // alloc this youranotherviewcontroller in ViewDidLoad
        [self presentModalViewController:youranotherviewcontroller animated:Yes];
        //It will show your another View having five more icons like keyboard
    }
}