作为概述,每当从堆栈中弹出视图时,我都会遇到UITabBarController内部的UINavigationController问题,并调用viewWillAppear.
从委托中,以编程方式创建UITabBarController:
// Create views for Tab Bar
UINavigationController *view1 = [[UINavigationController alloc] initWithRootViewController:[[newsFeedNavigationController alloc] initWithStyle:UITableViewStylePlain]];
resizedTabBatItem *tabBarItem1 = [[resizedTabBatItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"newspaper.png"] tag:0];
[view1 setTabBarItem:tabBarItem1];
[tabBarItem1 release];
UIViewController *view2 = [UIViewController new];
resizedTabBatItem *tabBarItem2 = [[resizedTabBatItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"speechbubble.png"] tag:1];
[view2 setTabBarItem:tabBarItem2];
[tabBarItem2 release];
....
// Create the tab bar controller
bookTabBarController = [BookTabBarController new];
[[bookTabBarController view] setFrame:CGRectMake(0, 0, 320, 460)];
// Add the views to it
NSArray *viewControllers = [NSArray arrayWithObjects:view1, view2, view3, view4, view5, nil]; …Run Code Online (Sandbox Code Playgroud) 我有一个视图,它是tabBarController的一部分.在这个视图中,我有一个带有表格的子视图.单击此表中的单元格时,我想访问父视图的navigationController.这可能 - 如果是的话,怎么样?
我以为会是
BandDetailViewController *bandDetailViewController = [[BandDetailViewController alloc] initWithNibName:@"BandDetailViewController" bundle:nil];
bandDetailViewController.band = [thisDay objectAtIndex:indexPath.row];
[super.navigationController pushViewController:bandDetailViewController animated:YES];
[bandDetailViewController release];
Run Code Online (Sandbox Code Playgroud)
但这不起作用.
iphone sdk subview uinavigationcontroller pushviewcontroller
我有2个带导航控制器的视图控制器.当我[self.navigationController popViewControllerAnimated:YES];在第二个中使用时 - 第一个打开,但viewDidLoad中的方法不会被调用.在这种情况下,第一个控制器中调用的方法是什么?
在为我的一个项目试用故事板时,我遇到了一些我没有很好解决方案的东西;
我有一个基于导航的应用程序,它显示了一个UITableViewController.tableView使用用户创建的元素填充.点击元素单元格会调出详细视图控制器.用户可以通过点击tableView中的按钮来创建新元素.这将打开一个模态视图,它将处理创建.
现在,当用户完成创建元素并解除模态视图控制器时,我希望用户看到相应的新细节视图控制器而不是tableview.但我无法弄清楚如何在故事板中实现这一目标.
有没有人有这个好的模式?
现在的情况
TableView --(tap create)--> creation modal view --(finish creating)--> TableView
Run Code Online (Sandbox Code Playgroud)
应该
TableView --(tap create)--> creation modal view --(finish creating)--> detail view
Run Code Online (Sandbox Code Playgroud) objective-c uinavigationcontroller modalviewcontroller ios uistoryboard
我正在寻找示例/教程/框架,解释如何做一个向左和向右滑动的导航栏/控制器,如Tinder.app和Twitter.app我不是在谈论面对刷Tinder的东西,我在说话关于顶级菜单和视图,我们可以完全向左或向右滑动以顺利进入应用程序的其他屏幕,如个人资料,时刻等
我到处寻找,但在那之前找不到任何有趣的东西,我希望你能指出我的一些东西.
我有一个UINavigationController根UIViewController("根").
根视图控制器推送另一个UIViewController"子".当"孩子" UIViewController出现在屏幕上时,我会旋转设备并期望"根"视图控制器相应地调整大小,但这不会发生.在根视图控制器中放置断点后:
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}
Run Code Online (Sandbox Code Playgroud)
我看到大小错误,根视图控制器无法正确调整更改.
有没有人经历过这种行为?
代码如下:
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
/// The size is wrong if this view controller is off screen
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Run Code Online (Sandbox Code Playgroud)

这是旋转设备后大小的NSLog的打印屏幕 - 这是来自模拟器,但设备上的行为是相同的.

objective-c uiviewcontroller uinavigationcontroller ios viewwilltransitiontosize
我有一个嵌入在导航控制器中的控制器,我想在导航栏中更改标题的字体.我想使用故事板,因此它会在应用程序中发生变化(而不是为NavigationController创建文件并通过代码执行); 不是每个控制器:
我可以更改字体大小和颜色,但在使用自定义字体时无法更改字体系列.在这种情况下,所有其他Xcode字体都有效.我在应用程序的任何地方都使用自定义字体,但只有在导航时才能使用.
这个问题可能是什么原因?
我有一个简单的设置表视图,它是UINavigationController的第一个视图.
我使用.FormSheet modalPresentationStyle呈现Settings UINavigationController,这意味着在iPhone上它占据全屏,而在iPad上,它以模态方式显示.
现在我想要设置表中的一行将SFSafariViewController推送到导航堆栈.
这在iPhone上运行良好,但在iPad上却没有.iPad截图:
请注意,SFSafariViewController导航栏的一部分显示在导航栏下方(使用"设置"后退按钮).在图像中看到红色矩形.
let urlText = "http://www.apple.com"
let url = NSURL(string: urlText)!
let safariViewController = SFSafariViewController(URL: url)
self.navigationController?.pushViewController(safariViewController, animated: true)
Run Code Online (Sandbox Code Playgroud)
在iPhone上,你根本看不到SFSafariViewController导航栏 - 这对我的用例来说是完美的.
任何神奇的设置,使这项工作正常?
一旦我添加了自定义栏导航栏按钮项,我就失去了使用默认功能返回的能力.我希望能够使用"从边缘滑动"返回.
我添加了Edge Pan Gesture Recogniser并将其连接到@IBAction,但是一旦识别出平移手势,解雇动作就会完全发生.
而不是慢慢地跟随我的拇指(如在其他应用程序中看到的),当前视图移出预定义的动画.
如何使用Edge Pan Gesture Recogniser按照我的拇指制作动画?
@IBAction func edgeSwipe(sender: AnyObject) {
navigationController?.popViewControllerAnimated(true)
}
Run Code Online (Sandbox Code Playgroud)
cocoa-touch uinavigationcontroller uigesturerecognizer swift
ios ×7
objective-c ×3
iphone ×2
swift ×2
cocoa-touch ×1
ipad ×1
navigation ×1
sdk ×1
storyboard ×1
subview ×1
uistoryboard ×1
uitableview ×1
xcode4 ×1