标签: uinavigationcontroller

在应用程序中有UITabBar和UINavigationController?

大家好,我是iPhone开发的新手,我不了解整个UINavigationController和UITabBarController的想法.是一个替代另一个 - Tweetie等应用程序如何结合?

我希望我的应用程序在底部有一个持久的Tab Bar(看起来很有效),但顶部还有一个导航栏,可以在不删除标签栏的情况下将视图推送/弹出到屏幕上.

  • 我怎么能做到这一点?
  • 对于所有这些控制器,IB的层次结构在我的MainWindow.xib中应该是什么样的?
  • 这里的最佳做法是什么?

非常感谢,

iphone uitabbarcontroller uinavigationcontroller iphone-sdk-3.0

7
推荐指数
1
解决办法
1万
查看次数

UINavigationController:标题跳转调整大小动画

我有一个ipad应用程序,我想隐藏并显示一个类别列表(有点像拆分视图控制器中的小视图),以及包含UiNavigationController堆栈的主视图.

我希望在隐藏类别列表时调整UINavigationController视图的大小以填充整个屏幕,并在显示列表时缩小.

我有它的工作,除了在动画开始/提交块中设置帧时导航栏的标题立即跳转到它的新偏移.

任何想法如何阻止标题的跳跃?

animation uinavigationbar uinavigationcontroller ipad ios

7
推荐指数
1
解决办法
2710
查看次数

如何在UINavigationController中获得弹出视图的通知?

我想,当用户按下我的后退按钮进行操作UINavigationController时,在一定的到来UIViewController.

不幸的是,看起来UINavigationControllerDelegate没有任何方法可以获得有关视图弹出的通知.

作为一种解决方法,我现在在viewDidDisappear方法中有我的动作,只有当animated它被触发时YES.这有效,但有点难看.

我该怎么做呢?

delegates uinavigationcontroller ios

7
推荐指数
3
解决办法
6778
查看次数

检查导航堆栈上是否存在ViewController

我在这里有这个代码来检查是否存在ViewController.不幸的是它不起作用.问题是,它是在另一个VC弹出的时刻执行的Navigation Stack:

- (void) leftViewDidHide{
    if ([((AppDelegate *)[UIApplication sharedApplication].delegate).frontViewController.navigationController.viewControllers objectAtIndex:1]) {
    SGServerListViewController *sample = [[[((AppDelegate *)[UIApplication sharedApplication].delegate).frontViewController.navigationController.viewControllers objectAtIndex:1]childViewControllers] objectAtIndex:0];
    [sample.serverTableView setUserInteractionEnabled:YES];
    }
}
Run Code Online (Sandbox Code Playgroud)

应用程序崩溃,异常断点将我指向带有if语句的行.关于这里可能出现什么问题的任何想法?我只是想检查它VC是否存在,如果是 - 执行代码.

iphone cocoa-touch objective-c uinavigationcontroller ios

7
推荐指数
3
解决办法
1万
查看次数

允许不同的导航控制器视图具有不同的方向规则

我试图遵循先前的问题,允许导航控制器视图控制器具有不同的方向规则.上一个问题

所以例如,我有两个视图控制器,第一个是欢迎第二个主页.我希望第一个视图控制器只能是Potrait而第二个(Home)允许Port/Landscape.

我不确定我完全理解如何完成这个.一旦我这样做,我打算创建一个单独的项目,解释如何执行此操作并添加到Github/share上的问题以供将来参考.

在这个特定的项目中,我使用侧视图控制器github项目.PPRevealSideViewController.

我的app代表如下:

// Then we setup the reveal side view controller with the root view controller as the navigation controller
welcomeViewController = [[MESWelcomeViewController alloc] init];
UINavigationController *navController = [[MESNavViewControllerSubClass alloc] initWithRootViewController:welcomeViewController];


self.revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:navController];
[self.revealSideViewController setDirectionsToShowBounce:PPRevealSideDirectionNone];
[self.revealSideViewController setPanInteractionsWhenClosed:PPRevealSideInteractionContentView | PPRevealSideInteractionNavigationBar];

//self.window.rootViewController = welcomeViewController;
self.window.rootViewController = self.revealSideViewController;
[self.window makeKeyAndVisible];
Run Code Online (Sandbox Code Playgroud)

从上面你可以看到我将导航控制器子类化为MESNavViewController.这是我对此文件的负责人:

@interface MESNavViewControllerSubClass : UINavigationController {
    BOOL setLandscapeOK;
}
Run Code Online (Sandbox Code Playgroud)

MESNavViewController的Imp文件:

-(void)viewDidLoad {
    NSLog(@"subclass called");
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    if (self->setLandscapeOK) …
Run Code Online (Sandbox Code Playgroud)

orientation uiviewcontroller uinavigationcontroller ios ios5

7
推荐指数
1
解决办法
1707
查看次数

如何使用外观正确地子类化UINavigationBar

这就是我想要实现的目标: 导航栏 注意:还有控制器的标题.

一些额外的信息: -

  1. 此导航栏将出现在大约10个视图控制器上.
  2. 它不是导航控制器的一部分,因为不需要.
  3. 左侧的按钮是静态的(将始终位于导航栏上).
  4. 右键不是静态的,在不同的视图控制器上不存在或不同.
  5. 左按钮用作滑动菜单(即菜单从左下方滑动)
  6. 我在设置中使用故事板

问题 实现这一目标的正确方法是什么?

现有代码 我试图实现这一点,但我只能得到一个或另一个按钮,没有标题工作.为了实现背景,我使用了外观API,如下所示:

didFinishLaunching ...

// Custom Navigation Bar appearance setup
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                       [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], UITextAttributeTextColor,
                                                       [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5],UITextAttributeTextShadowColor,
                                                       [NSValue valueWithUIOffset:UIOffsetMake(0, 1)],
                                                       UITextAttributeTextShadowOffset,nil]];
// Used to deal with the rotation of the nav bar when implemented outside of Navigation Controller
[[UINavigationBar appearance] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight];
[[UINavigationBar appearance] setContentMode:UIViewContentModeScaleAspectFit];

// Set the background image
UIImage *imageBg = [[UIImage imageNamed: …
Run Code Online (Sandbox Code Playgroud)

uinavigationbar uinavigationcontroller uinavigationitem ios ios5

7
推荐指数
1
解决办法
5582
查看次数

使用UINavigationController进行iOS 7自定义当前转换

我正在使用iOS 7自定义转换来呈现UINavigationController.但有一个问题.虽然它的动画,导航栏的大小只有44个点.完成动画后,导航控制器发现有状态栏,因此状态栏增加了20个点.

我的问题是,是否可以在动画时将导航栏设置为64磅,因此在完成动画时它不会再改变.

请在此处查看更多详细信息自定义视图转换

这是我的自定义动画代码:

 - (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{

    UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];

    CGRect finalFrame = [transitionContext finalFrameForViewController:toViewController];

    UIView *containerView = [transitionContext containerView];

    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    toViewController.view.frame = CGRectOffset(finalFrame, 0, screenBounds.size.height);
    [containerView addSubview:toViewController.view];

    NSTimeInterval duration = [self transitionDuration:transitionContext];

    [UIView animateWithDuration:duration delay:0.0 usingSpringWithDamping:0.6 initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
        toViewController.view.frame = finalFrame;
    } completion:^(BOOL finished) {
        [transitionContext completeTransition:YES];
    }];
}
Run Code Online (Sandbox Code Playgroud)

更新:有人解决了这个问题.但非常hacky.将toViewController.view添加到containerView后添加此代码.

if ([toViewController isKindOfClass:[UINavigationController class]]) {
    UINavigationController* navigationController = (UINavigationController*) toViewController;
    UINavigationBar* bar = navigationController.navigationBar;
    CGRect frame = bar.frame;
    bar.frame = …
Run Code Online (Sandbox Code Playgroud)

statusbar transitions uinavigationcontroller ios ios7

7
推荐指数
1
解决办法
2922
查看次数

放大UITextField

我正在开发一个包含许多UIView的iOS应用程序.UINavigation用于在这些视图之间导航.

我的一个UIView包含UITextField.我的问题是,当我缩放它时显示另一个视图的内容.我没有添加任何缩放代码.

下面是我实际设计的屏幕截图.实际设计

在缩放时,它显示导航的根视图 在此输入图像描述

此外,它在模拟器上正常工作.当我在设备上测试应用程序时检测到此问题.

提前致谢

zoom uitextfield uiview uinavigationcontroller ios

7
推荐指数
1
解决办法
385
查看次数

UINavigationController清除背景颜色

这个简单的例子,但不起作用;

我有ViewController里面的NavigationConroller,然后我想添加新的ViewConroller及其自导航控制器.

在主viewController中:

CustomViewController *vc = [[CustomViewController alloc] init];
NewNavigationVC *nav = [[NewNavigationVC alloc] initWithRootViewController:vc];

[self presentViewController:nav animated:NO completion:nil];
Run Code Online (Sandbox Code Playgroud)

两个控制器的背景颜色清晰,但仍然是黑色.导航栏我可以清楚,但不是视图.

更新:

如果我将self.window.backroundColor更改为红色,例如,该工作但不清楚

更新2:

[self addChildViewController:vc];  
[self.view addSubview:vc.view];
[vc didMoveToParentViewController:self];
Run Code Online (Sandbox Code Playgroud)

当我想dealloc vc

[vc willMoveToParentViewController:nil];
[vc.view removeFromSuperview];
[vc removeFromParentViewController];
Run Code Online (Sandbox Code Playgroud)

所有工作都没有导航控制器

uiviewcontroller uinavigationcontroller ios

7
推荐指数
1
解决办法
4395
查看次数

iOS Present Viewcontroller getting black screen

I am trying present ViewController I have created with StoryBoards:

 AuthViewController *authViewController = [[AuthViewController alloc] init];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:authViewController];
    UIViewController *vc  = [[[[UIApplication sharedApplication] windows] firstObject] rootViewController];
    [vc presentViewController:nav animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

But getting it with black screen. What could be the issue?

objective-c uinavigationcontroller ios

7
推荐指数
1
解决办法
5516
查看次数