标签: popviewcontrolleranimated

导航控制器popViewControllerAnimated:yes未按预期工作

我正在使用以下代码行:

[self.navigationController popViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)

但它在ios 7中表现不像在ios 6中那样.有些时候它不会弹出控制器,而我们连续按下按钮2-3次.
导致导航栏中出现突然行为并取消分配控制器但在ui上显示相同的内容.
因此,当我们按下该控制器上的任何内容时,由于控制器已经被释放,因此导致崩溃.

uinavigationcontroller ios popviewcontrolleranimated

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

使用popViewControllerAnimated时,按钮色调会改变颜色

视图#1中,我在故事板中设置了两个控件; 一个是导航栏中的UIBarButtonItem,另一个是UISegmentedController.前者是自定义绘制的图像,两个项目的色调都设置为紫色(故事板属性检查器中设置的色调).

通过各种动作,用户可以通过视图#1进入视图#2.如果在View#2中未满足某个条件,则会向用户显示错误消息,并在单击"确定"后重定向回View#1.

相关代码:

if(i == [self.itemsAvailable count]){
    UIAlertView *alertView = [[UIAlertView alloc] 
                    initWithTitle:@"Oh no!" 
                    message:@"Warning message text!" 
                    delegate:self 
                    cancelButtonTitle:@"OK" 
                    otherButtonTitles:nil, nil];

    [alertView show];

    break;
}
Run Code Online (Sandbox Code Playgroud)

请注意,警报是在while循环内触发的,因此break;.然后,以下函数返回到View#1

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == [alertView cancelButtonIndex]) {
        // Jump back one screen
        [self.navigationController popViewControllerAnimated:YES];
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是,当我使用该函数返回View#1时popViewControllerAnimated:YES,前面提到的两个控件(UIBarButtonItemUISegmentedController)的色调显示为灰色而不是所需的紫色.

选择不同的UISegmentedController值带回合适的色调的颜色,但我需要离开查看#1的UIBarButtonItem …

objective-c ios popviewcontrolleranimated uistoryboard

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

使用popViewController自定义过渡时如何防止键盘关闭

为了在全视图中提供交互弹出手势,我的控制器中有一个 UIPanGestureRecognizer,我们可以使用它从左向右滑动视图控制器中的任何位置来弹出控制器,而不是使用默认的 NavigationController 弹出手势。

当我在视图中使用键盘打开的手势时,键盘也会通过交互解除(默认 NavigationController 弹出手势不发生),这看起来很奇怪。

   func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
     if operation == .pop {
        return PopControllerTransition()//My transition
    }
    return nil
}
Run Code Online (Sandbox Code Playgroud)

如何在使用自定义弹出转换弹出 viewController 时防止键盘关闭。

  //transition code
  func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
    let containerView = transitionContext.containerView
    let fromController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)!
    let toController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!

    toController.view.transform = CGAffineTransform(translationX: -(toController.view.bounds.width/3), y: 0)
    containerView.insertSubview(toController.view, belowSubview: fromController.view)

    let view = GradientView(frame: containerView.frame)
    view.horizontal = true
    view.backgroundColor = UIColor.clear
    view.transform …
Run Code Online (Sandbox Code Playgroud)

uinavigationcontroller popviewcontroller ios popviewcontrolleranimated swift

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

为什么我的tableview没有调用didselectrowatindexpath直到第二次触摸?

我有一个包含自定义行的父表视图,每个视图控制器都推送一个视图控制器,其中包含tableview一些可选择的选项,这些选项存储为父视图控制器的属性.我的代码:

- (void) tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
  /*
    CrewPositions *selectedPosition = (self.crewPositionList)[indexPath.row];
    [self.delegate childCrewPositionDidSelect:selectedPosition];
    NSLog(@"child Selected Position: %@", selectedPosition.title);
    [[self navigationController] popViewControllerAnimated:YES];
  */
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryCheckmark;

    CrewPositions *selectedPosition = (self.crewPositionList)[indexPath.row];
    self.selectedCrewPosition = selectedPosition;
    NSLog(@"self.selectedCrewPosition: %@", self.selectedCrewPosition);
    selectedFlightHistory.crewPosition = selectedPosition;
    NSLog(@"self.selectedFlightHistory.crewPosition: %@", selectedFlightHistory.crewPosition.title);

    [self.delegate childCrewPositionDidSelect:selectedPosition];

    NSLog(@"Popping view to parent");
    [self.navigationController popViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)

工作正常,不幸的didSelectRowAtIndexPath是,直到我第二次点击单元格列表后才会调用该方法.当我这样做时,它将先前选择的第一行传递给父视图.忽略大量的NSLog,只是捕捉变量正在做什么.

objective-c uitableview ios popviewcontrolleranimated

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

关闭并弹出视图控制器

我想在视图控制器堆栈上返回两个级别.我按顺序有三个segue:Show,Show,Present Modally.有一个导航控制器正在使用中.从我的第四个观点来看,我想回到第二个视图.我试过用 self.presentingViewController?.presentingViewController?.navigationController?.popViewControllerAnimated(false);

self.presentingViewController?.presentingViewController?.dismissViewControllerAnimated(false, completion: nil);

第二个只有当第二个和第三个被称为"模态呈现"时才有效.如何让他们与解雇和流行音乐一起工作?

uiviewcontroller ios popviewcontrolleranimated swift

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

当调用navigationController popViewControllerAnimated时,不会调用viewController的dealloc

我有一个MyViewController,它基于UIViewController,我使用它像下面的代码:

MyViewController *nextViewController = [[MyViewController alloc] init]; [self.navigationController pushViewController:nextViewController animated:YES]; [nextViewController release];

在具有用户事件的MyViewController中,具有以下代码:

[self.navigationController popViewControllerAnimated:YES];

现在,我发现,MyViewController的dealloc不会被调用,但是,当我将App切换到后台时,例如,传递home按钮,dealloc方法已被调用!这个大问题!当用户转到MyViewController并且一次又一次地返回时,会有很多MyViewController不会被释放,而且只有当App转到后台时才会释放大量内存.

所以,有人可以帮我解决这个问题,谢谢!

memory-leaks dealloc navigationcontroller ios popviewcontrolleranimated

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

弹出到初始视图控制器

我目前正在编写一个使用嵌入式navigationControllers的应用程序.我需要从嵌入式视图中弹出第一个视图控制器的初始视图.

这行代码只是让我回到嵌入式navigationController的初始视图:

[self.navigationController popToRootViewControllerAnimated:YES];

有任何想法吗?

iphone objective-c uinavigationcontroller ios popviewcontrolleranimated

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

我的retainCount正在增加?

我正在尝试构建rss阅读器,当用户完成阅读artical并按回dealloc时不会调用的问题

我得到了retainCount 6和7次!

我有很多自定义面板

当按下后退按钮时,视图是poped并且没有dealloc被称为?!

.h文件:

 @interface ArticalViewController : UIViewController<UIWebViewDelegate,UIScrollViewDelegate,UIActionSheetDelegate,ArticalBottomPanelDelegate,ArticalContentFetcherDelegate> {

    UIWebView * description_;
    UIActivityIndicatorView * ind_;
    ArticalModel * artical_;
    NSString * content;
    UIButton * faceBookShareBtn_;

     UIBarButtonItem * btnSharePanel_;


     CustomTopToolBar * topToolbar_;

     ArticalBottomPanel* articalBottomPanel_;
     MovingSharePanel * movingSharePanel_;

     int fontSize;
     BOOL favoStatus;
     ArticalContentFetcher *datafetcher_;     

 }


@property (nonatomic,retain) IBOutlet UIWebView * description;
@property (nonatomic,retain ) IBOutlet UIActivityIndicatorView * ind;
@property (nonatomic,retain) ArticalModel * artical;
@property (nonatomic,retain) IBOutlet UIButton * faceBookShareBtn;


@property (nonatomic,retain) IBOutlet  CustomTopToolBar * topToolbar;
@property (nonatomic , retain) IBOutlet ArticalBottomPanel …
Run Code Online (Sandbox Code Playgroud)

memory iphone dealloc retaincount popviewcontrolleranimated

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

UINavigatorController popViewController:动画显示iOS 5.1中的奇怪行为,但不显示iOS 6中的行为

我发现了一些我在iOS应用程序中无法解释的奇怪行为.

我正在使用嵌入在UITabBarController子类中的标准UINavigationController.

当我在NavigationController上推送一个ViewController时,动画就可以了.但是当在Landscape中弹出ViewController时,弹出动画从屏幕顶部发生到下端,而不是预期的从右到左标准行为.

更奇怪的是,TabBar包含在动画过渡中,在纵向模式下也不是这样.

这只发生在iOS 5设备上,目前我还不知道为什么会发生这种情况.

uinavigationcontroller ios5 popviewcontrolleranimated

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

popViewControllerAnimated动画无效

我知道这是一个重复的问题,但我仍然无法弄明白.当应用程序转到后台然后重新启动时,动画无效.应用程序第一次启动时我可以在视图之间获得推/动画动画,但是一旦应用程序转到后台,它就会停止动画制作.

我创建了一个自定义导航控制器类,在其中扩展UINavigationController和编写popViewControllerAnimated方法.

- (UIViewController *)popViewControllerAnimated:(BOOL)animated {
    UIViewController* viewController = [super popViewControllerAnimated:animated];    
    UIViewController* nextViewControler = [[self viewControllers] lastObject];
    [nextViewControler viewWillAppear:animated];    
    [viewController viewWillDisappear:animated];
    return viewController;
}
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏.

objective-c uinavigationcontroller ios5 popviewcontrolleranimated

0
推荐指数
2
解决办法
1691
查看次数