Tag: uinavigationcontroller

自定义UITabBarController和UINavigationController

我正在开发一个适用于iOS5的应用程序,我不使用故事板或IB。 我正在创build一个自定义的UITabBarController并在我的AppDelegate我把它只有1个UINavigationController (不能告诉为什么)4视图控制器。 它导致了一种行为,我只能从第一个选项卡推送新的VC,显然,这个选项卡打包到名为navController的UINavigationController : SGTabBarController *tabBarController = [[SGTabBarController alloc] init]; SGHomeViewController* vc1 = [[SGHomeViewController alloc] init]; SGChooseOSAgainViewController* vc3 = [[SGChooseOSAgainViewController alloc] init]; SGSmsServicesViewController* vc4 = [[SGSmsServicesViewController alloc] init]; SGSupportViewController *vc5 = [[SGSupportViewController alloc] init]; navController = [[UINavigationController alloc] initWithRootViewController:vc1]; NSArray* controllers = [NSArray arrayWithObjects:navController, vc3, vc4, vc5, nil]; tabBarController.viewControllers = controllers; self.window = [[UIWindow […]

iOS:“单向”导航控制器的最佳做法?

我正在开发一个基本上是许多不同testing序列的应用程序(为简单起见,考虑SATtesting或Mensatesting)。 每个testing都在不同的View + View Controller中实现。 最初我想用Storyboard和UINavigationControllers来pipe理testing的顺序和它们之间的转换,但现在我正在质疑这种方法的有效性。 一个UINavigationController是一个堆栈,而我的导航是单向的(一旦你完成了一个testing,你不能回去)。 有没有更好的方式来实现应用程序? 我仍然可以利用故事板吗?

当以编程方式设置提示时,UINavigationBar与UITableView重叠

我有一个包含UITableViewController的UINavigationController 。 这个导航控制器将周围的其他UITableViewControllers,最终这些表视图控制器将有一个提示。 问题是,当我以编程方式设置此提示时,它将与其下方的表视图的内容重叠。 (search栏正在被导航栏隐藏) 我正在四处寻找,并find了答案 。 我在受影响的视图控制器中以两种不同的方式尝试了这个build议,但没有任何改变: override func viewDidLoad() { super.viewDidLoad() self.edgesForExtendedLayout = .None; self.extendedLayoutIncludesOpaqueBars = false; self.navigationItem.title = NSLocalizedString("Add Anime or Manga", comment: "") self.navigationItem.prompt = NSLocalizedString("Search media belonging to this series.", comment: "") } – override func viewDidLoad() { super.viewDidLoad() self.navigationItem.title = NSLocalizedString("Add Anime or Manga", comment: "") self.navigationItem.prompt = NSLocalizedString("Search […]

如何更换/自定义故事板navigationcontroller中的button图像

我想用自定义图像replace后退button中的文本。 我怎样才能做到这一点在迅速代码? 我不想replace整个backbarbutton,因为我想保持回到最后一个视图的默认行为行为。 我还想根据返回目的地(基于storyboardId)的位置做一个switch语句,以便我可以根据视图显示不同的图像。 这取代了图像,但它抹去了默认的后退button的行为,我需要区分什么是返回目的地,以便我可以显示右后方图像。 self.navigationItem.leftBarButtonItem = UIBarButtonItem(image:StyleKit.imageOfMap, style:.Plain, target:self, action:nil);

UITableView被UITabBar部分隐藏

我有一个包含UINavigationController的UITabBarController 。 在可见的UIViewController ,我正在编程创build一个UITableView ,如下所示: self.voucherTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain]; self.voucherTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; 但是,UITabBar与UITableView重叠。 当我输出[[UIScreen mainScreen] applicationFrame]的高度时,它返回460.00,而它应该是367.00。 在界面生成器中,我使用“模拟度量标准”自动将视图的高度设置为367.00。 有什么我失踪,无论我尝试什么,我不能看到我需要的367.00高度。 作为一个临时解决scheme,我已经手动设置了UITableView的框架,这不是很理想,所以最好解决这个问题: self.voucherTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 367) style:UITableViewStylePlain];

如何一次性popup模式视图和以前的导航控制器视图?

我还没有发现任何类似于谷歌或堆栈溢出… 我想要做的是同时popup一个模态视图和前一个视图。 例如,查看日历应用程序。 当你在“ Edit ”屏幕上,select“ Delete Event ”,你将被带回日历视图。 popup的“ Edit ”屏幕以及“ Event ”屏幕(用户正在查看日历事件)。 我遇到的问题是,我知道如何popup一个模态视图…但是从同一个UIViewController子类(本例中的“ Edit ”屏幕), 如何popup一个不是模态的视图 ? 我正在考虑像通常那样popup模态视图,然后将“ NSNotification ”发布到“ Event ”(例如)屏幕的UIViewController子类,并告诉它popup该视图。 另一件事是animation,它应该是dismissModalViewControllerAnimatedanimation(向下滑动),而不是popViewControllerAnimatedanimation(向左滑动)。 谢谢。 另外,寻找一个比这更好的解决scheme,这不工作在我的情况(至less不是与popViewControllerAnimated )

以编程方式更改导航栏的高度

我想做一个更高的导航栏,我正在尝试使用UINavigationBar的子类来做到这一点。 这是我的UINavigationBar的子类: import UIKit class TallerNaviBar: UINavigationBar { override func sizeThatFits(size: CGSize) -> CGSize { var newSize:CGSize = CGSizeMake(size.width, 87) return newSize } } 而在我的ViewController里面embedded了一个导航控制器,我在viewDidLoad()函数中写了下面的代码 self.navigationController!.setValue(TallerNaviBar(frame: CGRectMake(0, 0, self.view.frame.size.width, 87)), forKeyPath: "navigationBar") 没有错误报告,但是当我运行代码时什么也没有得到。 一个完全空白的视图。 。 任何build议? 或者改变身高的其他方法? 谢谢。

如何使UINavigationController的导航栏显示在底部?

有什么办法使UINavigationController的默认导航栏显示在底部而不是顶部? 我知道有一个UIToolbar可以显示在底部,但那个是特定于每个视图,不带有“后退”button。

在Storyboard中使用UINavigationController的popup窗口大小

我创build了一个iPad应用程序,其中包含embedded在导航控制器中的popup窗口视图。 我喜欢尽可能多地使用Storyboard,并且在Xcode中设置"Use Explicit Size"使我在iPad上popup正确的大小。 但是,在Xcode中查看故事板时,它不会调整UINavigationController视图及其embedded的UIViewControllers大小。 这是非常烦人的,因为我在Xcode中的视图的大小不符合popover的实际大小。 所以,我的问题是没有设置popover的正确大小(我也知道我可以用代码做到这一点),但我希望故事板中的视图显示我的意见的实际大小。 什么是使用故事板创buildembedded在导航控制器中的viewControllers的正确方法?

iOS:在自定义导航栏中定位导航栏button

我正在build立一个自定义导航栏的应用程序。 经过一番研究,我决定在UINavigationBar上使用一个类别来做这件事。 导航栏需要比平常大一点,以适应阴影。 这里是代码: #import "UINavigationBar+CustomWithShadow.h" @implementation UINavigationBar (CustomWithShadow) – (void)drawRect:(CGRect)rect { // Change the tint color in order to change color of buttons UIColor *color = [UIColor colorWithHue:0.0 saturation:0.0 brightness:0.0 alpha:0.0]; self.tintColor = color; // Add a custom background image to the navigation bar UIImage *image = [UIImage imageNamed:@"NavBar.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, 60)]; […]