标签: uinavigationcontroller

尝试为viewController转换iOS4设置自定义动画时出错

我正在构建一个iPhone应用程序,我已经实现了一个关于应用程序主题的知识库部分.我使用了表视图和导航viewController,以便在选择表中的任何单元格时,将创建一个新的视图控制器并将其添加到导航堆栈中.

我试图自己实现curl up/down动画但是我在运行时遇到这个错误

父视图控制器在调用时使用遗留包含 - [UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]'

这是代码示例

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

// change the accessory button to activity indicator
UITableViewCell *cell = [mTableView cellForRowAtIndexPath:indexPath];


SomeViewController *ad = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:[NSBundle mainBundle]];
ad.title = cell.textLabel.text;


[self.navigationController addChildViewController:ad];
[self.navigationController transitionFromViewController:self toViewController:ad duration:0.7 options:UIViewAnimationOptionTransitionCurlUp animations:^{} completion:^(BOOL completed){
    [ad release];
}];
Run Code Online (Sandbox Code Playgroud)

非常感谢任何帮助,建议和提示!谢谢!

objective-c uinavigationcontroller uiviewanimationtransition

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

UINavigationBar在transitionFromViewController期间跳转20像素

在尝试使用Apple的UIViewController包含时,我遇到了动画两个UIViewControllers之间转换的问题.

这是设置...我创建了一个UITabBarController,在其中一个选项卡中我创建了一个UIViewController作为容器.这个ViewController管理UIViewController和UINavigationController之间的转换.之前的观点是:

显示VC 1

点击"下一步"按钮后,视图将以flipFromRight过渡开始转换.在过渡期间,导航栏处于"到"视图中,但位于距视图顶部边缘20个像素的位置.图片如下:

在此输入图像描述

绿色是容器视图的背景颜色.新视图完成转换后,导航栏将捕捉到视图的顶部,最终结果为:

最终状态

捕捉到位的时间与动画的持续时间无关.我达到了我想要的最终状态,但过渡是一个问题.

我已经检测了viewController生命周期,导航栏和UITableView的框架在XIB中指定.xib看起来像这样:

xib配置视图

这是代码:

在-viewDidLoad中 -

_fromVC = [[FromVC alloc] initWithNibName:@"FromVC" bundle:nil delegate:self];

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

在我的按钮处理程序 -

- (void)buttonSelected
Run Code Online (Sandbox Code Playgroud)

{

//
//  Create the "to" View controller
//
ToVC *toVC = [[ToVC alloc] initWithNibName:@"ToVC" bundle:nil];

//
//  Create the navigation controller for the study activity
//
_toNavCon = [[UINavigationController alloc] initWithRootViewController:toVC];

[self addChildViewController:_toNavCon];
[_fromVC willMoveToParentViewController:nil];

[self transitionFromViewController:_fromVC
                  toViewController:_toNavCon
                          duration:0.7
                           options:UIViewAnimationOptionTransitionFlipFromRight
                        animations:nil
                        completion:^(BOOL finished) {
                            [_fromVC removeFromParentViewController];
                            [_toNavCon didMoveToParentViewController:self];
                        }];
Run Code Online (Sandbox Code Playgroud)

}

"to"视图控制器中没有代码可以更改视图控制器的外观.

另一点信息......当我在模拟器中"切换In-Call状态栏"时,导航栏顶部的间隙是In-Call状态栏的高度.

我查看了网络上的所有内容,没有任何帮助.有谁见过这个并且有人修理过吗?

animation uiviewcontroller uinavigationcontroller ios6

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

如何设置模式segue(以编程方式)到push segue

我的故事板中有一个导航控制器,但由于一个原因,我必须以编程方式制作一个segue,但我如何以编程方式制作推送segue?

到目前为止这是我的代码:

- (IBAction)nextviewButton:(id)sender {
    HolesViewController *Holes = [self.storyboard instantiateViewControllerWithIdentifier:@"HolesViewController"];
    Holes.nameString = self.NameField.text;

    [self presentViewController:Holes animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

xcode uinavigationcontroller pushviewcontroller ios6 xcode4.5

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

iOS以编程方式更改AppDelegate中的视图

我试图在特定推送通知发生时更改视图,我取得了一些小小的成功.(使用推送通知解析,适用于应用程序打开和关闭的时间).

我的故事板看起来像这样,我正在尝试将AppDelegate中的视图更改为DetailViewController. 在此输入图像描述

现在我可以通过更改根控制器来更改视图,但我只能连接我的选项卡视图或导航而不是两者.

 UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
    DetailViewController *detail = (DetailViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"detail"];
    [detail setDetailItem:StreamData[2]];

    self.window.rootViewController = detail;
Run Code Online (Sandbox Code Playgroud)

当然,(下面)的使用仅适用于其他控制器.

[self.navigationController pushViewController:detail animated:YES];
Run Code Online (Sandbox Code Playgroud)

我想知道这是否可以从AppDelegate实现,同时维护底部的tabbar和顶部的导航?

我最初的工作是设置从AppDelegate到可从所有控制器访问的全局变量的触发器,然后使用viewDidAppear之类的东西来检查它们是否需要更改.这似乎太资源密集,但它维护我的布局.

我的问题与此类似:在通知后,从app delegate中的标签栏中推送视图控制器

uitabbarcontroller uinavigationcontroller ios appdelegate

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

在没有故事板的情况下以编程方式选择UINavigation控制器

我有使用Storyboard进行seques的代码,如下所示:

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"ShowDiagnosis"])
    {
        [segue.destinationViewController setHappiness:self.diagnosis];
    }
    ...
Run Code Online (Sandbox Code Playgroud)

但我想以编程方式进行.我有myViewController类,当我点击一个按钮时,我想动画并推送到myUINavigationController.

这是如何以编程方式完成的?

uiviewcontroller uinavigationcontroller ios ios6

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

警告:正在进行演示或解除时,尝试从视图控制器<UINavigationController:0xb359a20>中解除

在我的应用程序中,我正在做的是:

rootViewController - > pushViewController - > pushViewController - > pushViewController - > presentModalViewController

从presentModalViewController我想直接去rootViewController.

所以我做的是:

while(theViewController = [theObjectEnumerator nextObject ])
     {
         if([theViewController modalTransitionStyle] == UIModalTransitionStyleCoverVertical)
         {
             [self.mNavigationController popToRootViewControllerAnimated:
              YES];
         }
     }
 }else
while(theViewController = [theObjectEnumerator nextObject ])
{
    if([theViewController modalTransitionStyle] == UIModalTransitionStyleCoverVertical)
    {
        [self.mNavigationController dismissModalViewControllerAnimated:YES];
    }
}
Run Code Online (Sandbox Code Playgroud)

但在这里我收到一条消息
警告:在演示或解雇过程中尝试从视图控制器中解除!

并在此应用程序崩溃后.

我搜索了这个,但找不到对我有用的东西,任何机构都可以解释为什么会这样吗?

objective-c uinavigationcontroller presentmodalviewcontroller ios poptoviewcontroller

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

翻转过渡uinavigationcontroller推

我正在使用以下代码在导航堆栈中推送UIViewController

[UIView animateWithDuration:0.75
                     animations:^{
                         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                         [self.navigationController pushViewController:ViewController animated:NO];
                         [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
                     }];
Run Code Online (Sandbox Code Playgroud)

现在,当我按回去时,我希望它能做同样的动画,但它不起作用.知道为什么吗?

在ViewController.m中

[UIView animateWithDuration:0.75
                     animations:^{
                         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                         [self.navigationController popToRootViewControllerAnimated:NO];
                         [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
                     }];
Run Code Online (Sandbox Code Playgroud)

objective-c uinavigationcontroller ios

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

tableView didSelectRowAtIndexPath在iOS 7上无法正常工作.为什么?

首先,我想说我只是提出这个问题,因为我想了解发生了什么.

我在Xcode5上的全新安装中打开了一个旧的Xcode项目(一个非常简单的项目).当我意识到它在iOS 7上不起作用时.为什么?不知道..

我看到了其他一些问题,没有得到任何有用的答案,所以我做了一个简单的测试.在UITableViewController所有工作正常,除了didSelectRowAtIndexPath

看看这个

RootViewController.h:

@interface RootViewController : UITableViewController

@property (strong, nonatomic) NSMutableArray *items;
@end
Run Code Online (Sandbox Code Playgroud)

RootViewController.m在viewDidLoad中我初始化数组(带有一些字符串).

实现dataSource和委托方法(是的,我将委托和dataSource设置为tableView)

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_items count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    // Configure the cell...
    cell.textLabel.text = [_items objectAtIndex:indexPath.row];

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

问题出在这里:

    - (void)tableView:(UITableView …
Run Code Online (Sandbox Code Playgroud)

uitabbarcontroller uitableview uinavigationcontroller ios ios7

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

iOS 7 UINavigationBar隐藏了后退按钮

我有一个应用程序,其UINavigationBars中有一个带有自定义图像的后退按钮.在iOS 6中一切都很好,但在iOS 7中,按钮在大多数情况下都是"隐形"的.

当我将一个新的视图控制器推入UINavigationController时,新的屏幕不显示后退按钮,但如果我触摸该按钮应该在哪里,它就会淡入.

如果我在导航控制器上设置了两个视图控制器而没有动画,则按钮显示正常,但不会显示后续推送.

我很确定我的代码中没有任何内容有意隐藏后退按钮并且更改UINavigationBar上可用的各种颜色没有任何区别.

back uinavigationbar uinavigationcontroller ios ios7

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

我将使用Ionic Framework在导航栏中插入两个按钮

我使用Ionic Framework,我只在这个页面的导航栏中插入两个按钮.

<ion-view title="{{title}}"> 
<ion-nav-buttons side="right">
    <a style="color: white;" class="button button-icon icon ion-folder" 
        ng-click="clickCreaElencoSpese()" ng-href="#/creaNotaSpese"></a> 
</ion-nav-buttons>
Run Code Online (Sandbox Code Playgroud)

我想在下面的图像中获得两个不同功能的图标.我怎么能够?

在此输入图像描述

icons button uinavigationbar uinavigationcontroller ionic-framework

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