对不起新手问题.我在主窗口视图中有一个UITabBar,每个Tab都有一个UINavigationControllers数组.该结构类似于iPod应用程序,通过选择TabBar项目可以看到主视图,然后用户可以通过将视图推送到堆栈来进一步向下钻取NavigationController.
我希望能够做的就是在代码中的任何子视图底部按下TabBar按钮(即,更改TabBar的选定属性并显示启动选项卡的第一个视图控制器) .
任何帮助将不胜感激.
戴夫
iphone cocoa-touch objective-c uinavigationcontroller uitabbar
UISegmentedControl当我将整个导航栏设置为黑色(self.navigationController.navigationBar.tintColor = [UIColor blackColor];)时,通常显示在所选按钮上的色调未显示.
这是一个我错过的错误吗?
我有两个controllers第一个self和第二个maincontroller,我maincontroller在堆栈中,所以后退按钮自动进入.
在这里,我需要在用户按下后退按钮时发出警报.
我怎样才能做到这一点?
所以我有以下层次结构:
UINavigationController- > RootViewController(UIViewController) - > UITableViewController- > DetailViewController(UIViewController)
我想将RootViewController上的方向锁定为仅限纵向,但保留其余视图控制器的所有方向.
如果我把它放到子类中UINavigationController:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)
然后将所有视图控制器锁定为纵向.
我的问题是,有没有办法只将RootViewController锁定为Portrait,但保留其他视图控制器的所有选项?
从Home视图 - 我的RootViewController - 当用户在导航层次结构中进行时,我一个接一个地打开2个ViewControllers,如下所示:
1)通过我的Storyboard中连接的按钮推送SecondViewController
2)ThirdViewController以模态呈现
[self performSegueWithIdentifier:@"NextViewController" sender:nil];
Run Code Online (Sandbox Code Playgroud)
所以,图片是:RootViewController - > SecondViewController - > ThirdViewController
现在在我的ThirdViewController中,我希望有一个按钮可以返回2次到我的RootViewController,即回家.但这不起作用:
[self.navigationController popToRootViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
只有这个人回到SecondViewController一次
[self.navigationController popViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
如何同时删除模态和推送视图控制器?
objective-c storyboard uiviewcontroller uinavigationcontroller ios
我一直在浏览iOS 7/UIKIT框架,虽然它在美学上看起来很不一样,但是从我能看到的内部真的是相同的SDK.
我的问题是,是否需要包含任何额外的代码才能获得推送的tableviews/views之间的可拖动行为?
将视图推送到UINavigationController时,您现在可以从侧面拖回到上一个控制器,而不是按后退按钮.
这种行为可以在邮件中看到.
如何实现,我是否需要添加任何代码才能将其添加到我的应用程序中?
是ios的新手,我发现这个解决方案使UINavigationBar透明化.在我的项目文件中我可以放置此代码
[self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
Run Code Online (Sandbox Code Playgroud)
因此它应用于我正在使用导航控制器的整个项目中.
我在故事板中添加了这些ViewControllers:

没有与自定义类相关联,一切都来自纯故事板.
这仅在iOS7上使用AutoLayout时发生.
有人见过这个吗?
首先,我已经看到了如何在IOS 8中制作UINavigationBar透明的 所有答案?透明UINavigationBar和Make UINavigationBar透明.
他们似乎并不适合我.
我的常规视图控制器(在尝试使导航栏透明之前)没有任何问题:
我正在使用(在viewDidLoad和中试过viewWillAppear:):
[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;
self.navigationController.view.backgroundColor = [UIColor clearColor];
Run Code Online (Sandbox Code Playgroud)
我明白了:
灰色状态栏背景,完全白色导航栏,不与状态栏混合,然后视图开始.其他问题"答案"中的所有"解决方案"对我来说都会产生相同的结果.
我也尝试过设置self.edgesForExtendedLayout = UIRectEdgeNone;,self.edgesForExtendedLayout = UIRectEdgeAll;但这也没有任何影响.
如何在不弄乱所有内容的情况下使导航栏透明?
更新:在Warif Akhand Rishi的回答之后,我已经改变self.navigationController.view.backgroundColor = [UIColor clearColor];了self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];,现在我得到一个灰色,统一的状态/导航栏,但仍然不透明:
更新2:我已经连接了视图调试器,并且灰色背景似乎来自视图层次结构的根本深处,并且我的视图内容没有扩展.我self.edgesForExtendedLayout = UIRectEdgeAll;再次尝试使用最新的代码,但仍无济于事:
将新控制器添加到导航堆栈时:
self.navigationController!.pushViewController(PushedViewController(), animated: true)
Run Code Online (Sandbox Code Playgroud)
从右边看:
如何更改动画的方向以使其从左侧显示?
ios ×7
iphone ×3
objective-c ×3
storyboard ×2
animation ×1
cocoa-touch ×1
ios7 ×1
ipad ×1
orientation ×1
swift ×1
uikit ×1
uitabbar ×1