Tag: uinavigationcontroller

iOS:UISplitViewController无法推送到UINavigationController

我有一个使用导航控制器的XCode iPad项目。 我试图得到一个button来推UISplitViewController到导航堆栈,但得到这个错误: 拆分视图控制器无法推送到导航控制器 原来UISplitViewController不能和UINavigationController一起玩。 但是,当点击这个button时,我仍然需要显示分割视图控制器。 我该怎么做呢? 而且,同样重要的是,如何制作后退button以便用户可以返回到导航控制器?

在iOS中使用手势导航UIViewController

我有几个视图控制器embeddedUINavigationController(一些模式,一些推),并通过使用滑动手势浏览他们, // Gesture recognizers UISwipeGestureRecognizer *downGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(dismissButton)]; downGesture.direction = UISwipeGestureRecognizerDirectionDown; [downGesture setCancelsTouchesInView:NO]; [self.view addGestureRecognizer:downGesture]; 这工作正常,但是我希望用户能够物理拖动模态表示的视图控制器,例如,向下和closures屏幕,而不仅仅是一个轻弹和一个animation做剩下的事情,或拖动到屏幕上,并捕捉到而不是点击后退button。 我已经尝试过在视图上使用平移手势来实现这一点,但是当然前面的视图控制器在它后面是不可见的,它是需要的。 这个效果如何正确实现? 视图控制器遏制? 如果是这样的话,将几个视图控制器放到堆栈上时会如何工作? 我在谈论的导航types的一个例子可以在LetterPress应用程序中find。 谢谢。

如何使用Interface Builder添加导航控制器?

1.步骤:创build一个新的UIViewController: – Xcode – >新build文件… – >cocoa触摸类 – > UIViewController – 名称:MyViewController 2.步骤:将“导航控制器”(UINavigationController)从库中拖放到MyViewController.xib中 步骤:我确定,我必须做一些事情才能正确连接导航控制器,不是吗? 4.Step:尝试启动新的View Controller作为模式对话框: MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; NSLog(@"navContr: %@", myViewController.navigationController); [self.navigationController presentModalViewController: myViewController animated:YES]; 结果:“navContr:nil” 5.Step:你可以看到新的模式视图(MyViewController),但是没有NavigationController,也没有UINavigationBar。 非常感谢您的帮助! 更新1: 6.Step:我设置了一个新的UIViewController(ViewNavi2)作为“Root View Controller”: 7.Step:我在类MyViewController中定义了一个IBOutlet UINavigationController *navigationController ,并configuration了xib:Navigation Controller – > Connections – > Referencing Outlets 但我的导航控制器仍然是零:-( MyViewController *myViewController = [[MyViewController alloc] […]

iOS – 半透明模式视图控制器

我想在当前的视图上以模态方式呈现一个略带透明背景的视图控制器,这样第一个视图在模态视图下稍微可见。 我设置了模式视图控制器的alpha值,并将modalPresentationStyle设置为UIModalPresentationCurrentContext ,如另一篇文章中的build议。 结果是animation时视图背景是透明的,但当视图控制器就位时,它变成不透明的黑色。 在解雇这个animation的过程中,它变得透明起来。 我怎样才能让它在活动时是透明的? 我已经在iOS 6 and 7testing。 我使用的代码如下: MyModalViewController *viewController = [[MyModalViewController alloc] init]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; [navController setNavigationBarHidden:YES]; self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext; [self.navigationController presentViewController:navController animated:YES completion:NULL];

UINavigationController方向更改中的ViewController

所以我有以下层次结构: UINavigationController – > RootViewController( UIViewController ) – > UITableViewController – > DetailViewController( UIViewController ) 我想lockingRootViewController上的方向为只有肖像,但保留其余视图控制器的所有方向。 如果我把这个子类UINavigationController : – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } -(NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskPortrait; } 所有的视图控制器然后locking到肖像。 我的问题是,有没有办法只lockingRootViewController到肖像,但保留其他视图控制器的所有选项?

导航回到上一个视图控制器

我有一个UIView->UICollectionView->UICollectionViewCell 。 我正在尝试导航回编程,但没有这些作品。 代码确实叫。 我正在使用StoryBoard。 – (void) goBack:(NSNotification *) notification { // [self.navigationController popViewControllerAnimated:YES]; // [self dismissViewControllerAnimated:YES completion:nil]; [self.navigationController popToRootViewControllerAnimated:YES]; }

像Instagram的导航栏(iOS 7)

我试图做出同样的影响,因为Instagram的标题。 我怎样才能做到这一点? 我尝试了很多解决scheme。 最好的 – https://github.com/andreamazz/AMScrollingNavbar 但它有一个大问题 – 使用uipangesturerecognizer移动栏。 这对我来说是不好的,因为我想performance出来吧,如果桌子在顶端。 我试图改变这个控件的工作,以滚动查看委托,但发现了很多问题,你有什么想法,他们是如何做到这一点?

presentViewController不支持iOS 6中的方向

我正在使用这个代码 if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]) { [self presentViewController:navigationControllerCustom animated:YES completion:nil]; } else { [self presentModalViewController:navigationControllerCustom animated:YES]; } 我的应用程序有两个方向肖像和肖像颠倒。 此代码适用于iOS 5.1,但在iOS 6上方向不起作用 我还在我的navigationControllerCustom类中添加了这段代码 – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown); } -(NSUInteger)supportedInterfaceOrientations { return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); } 请帮我解决这个问题。 提前致谢。

UINavigationItem以标题为中心

我有一个左侧和右侧栏button两侧的导航栏。 我有一个customTitlelabel ,我设置为UINavigationItem的titleView。 [self.navigationItem setTitleView:customTitleLabel]; 现在一切正常。 问题是,rightbarButton的大小是基于我在其中一个文本字段中得到的input是dynamic的。 因此标题会根据button之间的可用空间自动居中。 我如何将标题设置为固定位置?

以编程方式创build一个UIBarButton

我有一个通常用类似下面的方式设置的酒吧button的数组: NSArray *leftButtonArray = [[NSArray alloc]initWithObjects: backBarButton, separator1,postBarButton, separator1, memeBarButton, separator1, pollBarButton, nil]; self.navigationItem.leftBarButtonItems = leftButtonArray; 不过,我想改变这些左边的button,而不是中心alignment。 任何人都知道我可以做到这一点? 提供一个例子或使用我的button来这样做将是一个加号。 谢谢!