标签: uinavigationcontroller

从'UIView*const_strong'分配给'AAViewController*__ strong'的不兼容指针类型

检查导航控制器堆栈中的控制器,但是分配控制器值会从"UIView*const_strong"中获取警告'不兼容的指针类型分配给'AAViewController*__ strong'

AAViewController*控制器;

for(UIView *view in self.navigationController.viewControllers)
{            
     if([view isKindOfClass:[AAViewController class]])
     {
         controller = view;
         break;
     }
}
Run Code Online (Sandbox Code Playgroud)

我在控制器=视图中收到错误提前感谢

uiviewcontroller uiview uinavigationcontroller ios ios6

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

无法使用ios中的Storyboard删除导航控制器中的BackButton

我是iOS新手,

我正在使用Storyboard为iPhone开发购物App,

这是我的应用程序的快照, TabBarController 包含4个标签 NavigationController

当我打开Tab1(让我说class1)它包含TableView,onclick of tableview它将带我到Detail page标题和后退按钮NavigationBar(我正在以编程方式添加标题和后退按钮ViewWillAppear method)之后,当我点击后退按钮我正确导航到上一页,这工作得很好..

我的问题是当我打开Tab1(即class1)并且当我Detail page在tableview中选择一行后导航到a Detail page,BackBtn并且将在NavigationBarbcoz中添加标题ViewWillAppear method将被调用,当我Tab2在击中Backbtn之前点击时,我导航到类Tab2当我回来时Tab1,现在我点击后退按钮我正在导航到我的前一页Tab1 class(即class1),但在class1 后面按钮和标题Detail page是我的,class1我无法隐藏它...

你可以在第二张图片中看到BackBtn并且Title在Class1... 有什么问题 ?

iphone back-button storyboard uinavigationcontroller ios

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

导航栏按钮未显示

当试图在左侧和右侧添加导航按钮时,它没有显示?这是我用过的代码,这有什么不对吗?

这是我在appdelegate中添加导航栏的方式,

  UIViewController *viewController1 = [[logyFirstViewController alloc] initWithNibName:@"logyFirstViewController" bundle:nil];
  UIViewController *viewController2 = [[logySecondViewController alloc] initWithNibName:@"logySecondViewController" bundle:nil];
  UIViewController *viewController3 = [[record alloc] initWithNibName:@"record" bundle:nil];
  UIViewController *viewController4 = [[searchview alloc] initWithNibName:@"searchview" bundle:nil];
  UIViewController *viewController5 = [[profilde alloc] initWithNibName:@"profilde" bundle:nil];
 self.tabBarController = [[UITabBarController alloc] init];

self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3, viewController4, viewController5];
navigationController = [[UINavigationController alloc] initWithRootViewController:self.tabBarController];

self.navigationController.navigationBar.barStyle=UIBarStyleDefault;

[navigationController.navigationBar setAlpha:0.8f];
 [self.window addSubview:[navigationController view]];





 button4 = [UIButton buttonWithType:UIButtonTypeCustom];
 [button4 setFrame:CGRectMake(0.0f, 0.0f, 25.0f, 25.0f)];
 [button4 addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
 [button4 setImage:[UIImage imageNamed:@"del.png"] forState:UIControlStateNormal];
 UIBarButtonItem *random1 = …
Run Code Online (Sandbox Code Playgroud)

iphone uinavigationcontroller ios6

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

如何将UINavigationController添加到呈现为Modal的UIViewController

我的应用程序中有另一种流程.这个流程从我的firstViewController开始,然后在这个视图中调用我的secondViewController,如下所示:

- (IBAction)PressButton:(id)sender {

    SecondViewController *second = [[SecondViewController alloc] init];
    second.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    UINavigationController *nav = self.navigationController;
    [nav presentViewController:second animated:YES completion:nil];                              
}
Run Code Online (Sandbox Code Playgroud)

在我的secondViewController中,我想推送我的第三个ViewController.但它不起作用我试过这种方式:

- (IBAction)pressButton:(id)sender {

   ThirdViewController *tvc = [[ThirdViewController alloc] init];
   UINavigationController *nav = self.navigationController;
   [nav pushViewController:tvc animated:YES];
Run Code Online (Sandbox Code Playgroud)

}

当我按下secondViewController的按钮时没有任何反应.

我做错了什么?

我正在使用:

  • OSX 10.8.2
  • Xcode 4.6
  • iOS 6.1

iphone xcode uinavigationcontroller presentmodalviewcontroller ios6

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

iOS状态栏自动更改颜色以匹配导航栏

我的AppDelegate中有一个UINavigationController,它有一个带有UITableView的RootViewController.启动时,状态栏会将其颜色更改为导航栏的颜色.当我将导航栏上色为橙色时,这就是状态栏的样子:

在此输入图像描述

似乎我的导航栏稍微向上移动了一下.导航控制器似乎无法识别状态栏.我该如何解决这个问题?

我在我的应用程序中唯一的东西是AppDelegate和一个空的RootViewController.我application:didFinishLaunchingWithOptions是:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
RootViewController *rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[navigationController.navigationBar setTintColor:[UIColor orangeColor]];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
return YES;
Run Code Online (Sandbox Code Playgroud)

我的RootViewController的IB文件只有一个空视图.

没什么不寻常的.我对iOS很有经验,这就是我每次都这样做的方式.我不知道这次有什么不同.

有人可以告诉我吗?谢谢

iphone cocoa-touch objective-c uinavigationcontroller ios

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

如何在iOS中保存/恢复视图状态?

我正在使用ECSlidingViewController创建一个滑出菜单(如Facebook).

我有这个故事板:

故事板

如你所见,我有一个导航控制器.我有一个主要问题,即使是制作该控制器的用户创建的官方演示也没有实现:它在更改视图然后返回时不会保存视图控制器的状态.

因此,例如,当我打开应用程序时,橙色视图将始终是第一个视图viewDidLoad.然后我切换到绿色视图(第二个),然后单击按钮.它将该视图的背景颜色更改为红色.然后,如果我回到我的第一个视图,然后回到第二个视图,后者的背景颜色再次变为绿色.我希望它保持红色.

这是我切换视图的代码(in MenuViewController):

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Get identifier from selected
    NSString *identifier = [NSString stringWithFormat:@"%@", [self.menu objectAtIndex:indexPath.row]];

    // Add the selected view to the top view
    UIViewController *newTopVC = [self.storyboard instantiateViewControllerWithIdentifier:identifier];

    // Present it 
    [self.slidingViewController anchorTopViewOffScreenTo:ECRight animations:nil onComplete:^{        
        CGRect frame = self.slidingViewController.topViewController.view.frame;
        self.slidingViewController.topViewController = newTopVC;
        self.slidingViewController.topViewController.view.frame = frame;
        [self.slidingViewController resetTopView];

    }];
}
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,它始终每次都实例化一个新的VC.我希望它保存VC,如果没有创建它,则创建新的,然后显示一个.如果用户返回到已创建的视图,则应该只恢复已保存的视图,而不是创建新视图.

我已经把它Init View Controller放在导航控制器中,现在我该如何为我的视图实现这种保存/恢复机制?我希望它与2,3,4等一起工作......尽可能多的观点.

谢谢.

objective-c uiviewcontroller uinavigationcontroller ios

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

尝试在视图不在窗口层次结构中的VC上显示模态VC

我的故事板看起来像这样:

故事板

这是它的工作原理:在其.m文件中InitialSlidingViewController实例化导航VC topViewController,如下所示:

 -(void)viewDidLoad {
  [super viewDidLoad];

  self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Navigation"];

}
Run Code Online (Sandbox Code Playgroud)

导航VC实例化后,它会创建基础菜单并将其设置为underLeftVC.这是使用ECSlidingViewController.这将创建一个使用平移手势的滑动菜单,类似于Facebook.

NavigationVC的rootVC是我的ItemsCDTVC.当我点击+按钮时,它会弹出一个动作表,允许我从相机拍摄照片或从照片库中选择.但是,我希望它以模态方式转换为ManageItemVC并设置我刚刚选择/拍摄到UIImageView的图片.当我尝试呈现时,它会抛出以下错误:

Warning: Attempt to present <ManageItemViewController: 0x81d52a0> on <InitialSlidingViewController: 0x8122ce0> whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)

这是真的,因为InitialSlidingVC不在屏幕上,ItemCDTVC是,但我该如何解决这个问题呢?

我在我的故事板中设置了模态类型segue,其中包含来自底部灵活空间的标识符(当点击时,它没有做任何事情,所以我选择了它来创建视觉segue).这是我在ItemCDTVC中的segue代码:

 -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    // let's get the edited image
    UIImage *image = info[UIImagePickerControllerEditedImage];
    // but if for some reason we disable editing in the future, this is our safeguard
    if(!image) image = info[UIImagePickerControllerOriginalImage];
    if(image) {
        self.pictureImageView.image = image;
        [self performSegueWithIdentifier:@"addItemSegue" …
Run Code Online (Sandbox Code Playgroud)

objective-c uiimagepickercontroller uinavigationcontroller modalviewcontroller segue

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

如何在IOS中为AppDelegate for Universal App添加导航控制器

如何在AppDelegate.m文件中添加通用应用程序的导航控制器,即iPhone和iPad.

uinavigationcontroller ios

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

iPhone:如何从视图控制器中的导航栏中删除右键?

我通过实现以下方法为所有视图创建了一个自定义导航栏 - :

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
//    viewController.navigationItem.rightBarButtonItem = cancelButton;
// -- Adding INFO button to Navigation bar --
UIBarButtonItem *infoButton =  [[UIBarButtonItem alloc]
                                initWithTitle:@"i"
                                style:UIBarButtonItemStyleBordered
                                target:self
                                action:@selector(showInfo)];
infoButton.tag = 10;
self.navCntrl.topViewController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:infoButton, nil];
self.navCntrl.navigationBar.tintColor = [UIColor colorWithRed:45/255.0 green:77/255.0 blue:67/255.0 alpha:1];
//    NSLog(@"Inside implemented method");
}
Run Code Online (Sandbox Code Playgroud)

的UINavigationControllerDelegate.

在上面的方法中,我在导航项中添加了一个右键.现在我想在特定视图中隐藏此右键.我怎样才能做到这一点?谢谢.

iphone uinavigationbar uinavigationcontroller ios

1
推荐指数
2
解决办法
9541
查看次数

UINavigationController和后退按钮标题

看起来像UINavigationBar的Back按钮使用视图控制器的标题作为标题,如果前一个视图控制器没有标题,它使用Back,但是有一种方法可以自定义后退按钮的标题,无论标题是什么以前的视图控制器有?

谢谢

objective-c uinavigationbar uinavigationcontroller viewcontroller ios

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