搜索这个我没有幸运,所以我们走了;)
我有一个UIViewController定制UINavigationBar,推动另一个UIViewController作为子视图.
除非单击子视图上的后退按钮,否则一切正常.预览(第一个)视图正确显示,但不是动画.动画UINavigationBar是正确的,只有视图立即切换.
使用for 调用- (void)viewWillAppear:(BOOL)animated第一个函数.这只发生在我使用iOS 5进行测试时,而不是使用iOS 4进行测试.UIViewControllerNOanimated
有谁知道如何解决这一问题?
谢谢你的帮助!汉纳斯
更新1
我刚刚删除了所有自定义代码并且只使用了普通代码UINavigationBar(所以没有额外的设置),它仍然不适用于iOS 5.这是我在第一个ViewController中用来推送第二个ViewController的代码:
[self.navigationController pushViewController:secondViewController animated:YES];
正如我已经提到的 - 当我在第二个视图的导航栏中单击后退按钮时,第一个视图立即显示而没有动画.
任何帮助,将不胜感激!谢谢!
更新2
我觉得我越来越接近这个问题,但仍然没有解决方案:
我只是添加了一个UINavigationController我打电话的自定义[super popViewControllerAnimated:animated].正确调用此get(动画为YES),但viewWillAppear第一个UIViewController获取NO作为动画的值...
iphone uinavigationbar popviewcontroller viewwillappear ios5
使用动画NO以编程方式在UINavigationController上执行多个弹出和推送操作时出现问题.(仅限iOS7 iPhone)
源代码 https://github.com/abhishek9284/NavigationBarTest
要了解问题,请考虑以下视图树.
(我在我的应用程序中使用UITableViewController)
右键单击并在新选项卡中选择打开图像以查看大图像.

错误信息
右键单击并在新选项卡中选择打开图像以查看大图像.

执行以下导航时出现错误/问题.
在上面的步骤2和3中,以编程方式使用动画NO进行弹出和推送,这使得UINavigationBar后退按钮和标题非常奇怪.
注意:上述问题仅在iOS 7中出现,并且在iOS 6中完美运行.
uinavigationbar uinavigationcontroller popviewcontroller pushviewcontroller ios
为了在全视图中提供交互弹出手势,我的控制器中有一个 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
我一直在努力使用UINavigationalController在视图之间切换.我已多次使用此系统而没有问题但在我的新应用程序中它无法正常工作.
这是问题:当我推动一个新的视图控制器时,我使用以下代码:
NewViewController *newVC = [[NewViewController alloc] initWithNib:@"NewView" bundle:nil];
[self.navigationController pushViewController:newVC animated:YES];
[newVC release];
Run Code Online (Sandbox Code Playgroud)
我用来返回newVC内部的前一个视图的代码是:
[self.navigationController popViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
我正在读这可能会释放self.navigationController本身,所以我实现了这段代码:
UINavigationController *nc = [self navigationController];
[nc popViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
什么结果是平滑过渡到newVC而没有白色闪光,但是当返回到原始页面时,屏幕闪烁白色,就像它在转换回原始页面之前释放newVC一样.然而!在调试时,我在原始页面的viewWillAppear和newVC的dealloc以及带有白色闪存的viewWillAppear +转换上放置了断点,在调用newVC的dealloc之前完成所有断点.
如果有人可以帮助发光,我会非常感激.
谢谢!〜阿拉什
我有一个应用程序NavigationController.我怎样才能改变的动画过渡的风格pushViewController和popToViewController?
UPD
我在@lawicko回答中创建了类别.但是当我试图调用函数时,我得到了错误
[self.navigationController pushViewController:places withCustomTransition:CustomViewAnimationTransitionPush subtype:CustomViewAnimationSubtypeFromLeft];
错误是:"使用未声明的标识符'CustomViewAnimationTransitionPush'"
我应该在哪里声明这部分:
typedef enum {
CustomViewAnimationTransitionNone,
CustomViewAnimationTransitionFlipFromLeft,
CustomViewAnimationTransitionFlipFromRight,
CustomViewAnimationTransitionCurlUp,
CustomViewAnimationTransitionCurlDown,
CustomViewAnimationTransitionFadeIn,
CustomViewAnimationTransitionMoveIn,
CustomViewAnimationTransitionPush,
CustomViewAnimationTransitionReveal
} CustomViewAnimationTransition;
Run Code Online (Sandbox Code Playgroud)
现在写我宣布它 UINavigationController+Additions.h
UPD 2:还有一个新错误:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CATransition", referenced from:
objc-class-ref in UINavigationController+Additions.o
"_kCATransition", referenced from:
Run Code Online (Sandbox Code Playgroud)
所有_kCATransitions都有同样的错误
animation uinavigationcontroller popviewcontroller pushviewcontroller ios
我遇到了问题popViewController.
我pushViewController用来去OrdersFormViewController
OrdersFormViewController *ordersFormViewController = [[OrdersFormViewController alloc] initWithNibName:@"OrdersFormViewController" bundle:nil];
[self.navigationController pushViewController:ordersFormViewController animated:YES];
[ordersFormViewController release];
Run Code Online (Sandbox Code Playgroud)
从OrdersFormViewController我显示UIAlertView viewDidLoad并调用,popViewController但这不起作用.
UIAlertView* alertView = [[UIAlertView alloc]
initWithTitle:@"Error"
message:@"Error"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
[alertView release];
[self.navigationController popViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
视图不会从navigationController中"弹出",但是当按下导航栏中的标准后退按钮时,只会更改导航栏而不是实际视图.
有谁知道为什么会这样?
我有三个视图控制器。当我到达第三个视图控制器时,我使用 poptorootviewcontroller 弹出到我的第一个视图控制器,但是当我在第三个视图控制器中使用 popviewcontroller 时(我想回到我的第二个视图控制器)它会弹出但是我在我的第二个视图控制器在那里,我希望第二个视图控制器是新的(重置这个视图控制器),就像重新加载这个视图控制器一样。这是我在第三个视图控制器中的代码:
-(IBAction)playAgain:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做?谢谢!
我在导航控制器的层次结构中的视图控制器上有一个自定义按钮,按下后会弹出可见的视图控制器.
我想使用UIView的transform属性为视图控制器的关闭设置动画.它可以工作,但如果我使用`popViewControllerAnimated:YES',动画的默认左侧幻灯片仍然存在,尽管我的自定义转换也可以.
如果我设置popViewControllerAnimated:NO它根本不动画任何东西.
我也研究了CATransition在popViewControllerAnimated设置时使用哪种方法NO,但是没有"缩放"效果是公共API的一部分,我不想使用私有效果.自定义过滤器也不适用于iPhone,仅适用于OS X.
所以我想我的问题是:
1)有没有办法在默认转换中删除左侧幻灯片但仍然使用自定义动画transform?
2)使用自定义过滤器的一些方法CATransition?
3)如果我使用私有API进行缩放效果,Apple会在拒收箱中丢弃我的应用程序的可能性有多大?
有没有人有我忽视的解决方案?
由于一个奇怪的请求,我试图拒绝,但它没有工作,我不得不覆盖navigationBar的后退按钮.
我已经制作了一个自定义的UINavigationController子类并且破解了该
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item方法.
这是我的代码:
@interface CustomUINavigationController ()
@end
@implementation CustomUINavigationController
#pragma mark - UINavigationBar delegate methods
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item {
if ([[self.viewControllers lastObject] isKindOfClass:[ViewController1 class]]) {
ViewController1 *vc1 = (ViewController1 *)[self.viewControllers lastObject];
[vc1 handleBackAction];
if (vc1.canPopVC == YES) {
[self popViewControllerAnimated:YES];
return YES;
} else {
return NO;
}
}
[self popViewControllerAnimated:YES];
return YES;
}
@end
Run Code Online (Sandbox Code Playgroud)
一切正常,除非我以编程方式弹出viewController.每次我想在弹出后执行推送时,应用程序都会崩溃.转向NSZombie on,显示当以编程方式弹出viewController时,其父viewController被释放.此时,制作自定义backButton不是一个选项,因为它将丢失原生iOS 7滑动到popViewController功能.
崩溃日志:
*** -[ContactsDetailViewController performSelector:withObject:withObject:]: message sent to deallocated instance 0x1806b790
Run Code Online (Sandbox Code Playgroud) 我有一个带有几个视图的navigationControll.一切正常.我现在想在子视图中调用该方法后在父视图中显示警报[self.navigationController popViewControllerAnimated:YES];.我将警报配置为在父视图控制器上显示viewDidLoad.但我承认的是,这只是在第一次调用视图时调用.每次回到这个视图时,是否有任何方法调用?THKS!
我有三个控制器,我想知道控制器是推或弹
控制器:
{
if(!b)
b = [B alloc] init];
[self.navigationController pushViewController:b animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
B控制器:
- (void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
//I want here to judge, from the "A" push over, or to return from the "C" "pop"
//if it is push from A
//dosomething.....
//if it is pop from C
//dosomething
}
-(void)testAction:(id)sender
{
C *c = [[C alloc] init];
[self.navigationController pushViewController:b animated:YES];
[c release];
}
Run Code Online (Sandbox Code Playgroud)
C控制器:
{
[self.navigationController popViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有一个表格视图,只要有人按下单元格,视图控制器就会弹出。这是我的tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)方法的代码:
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//previously written code
navigationController?.popViewController(animated: true)
}
Run Code Online (Sandbox Code Playgroud)
一切工作正常,除了一种情况:加载视图后,我尝试立即按任何单元格。在这种情况下,popViewController未执行,我收到此错误:
popViewControllerAnimated:在发生现有转换或演示时调用 UINavigationController;导航堆栈不会更新。
我知道,这个问题之前在 StackOverflow 上出现过,但我没有找到任何其他解决方案:
DispatchQueue.main.asyncAfter(deadline: .now() + //time) {
navigationController?.popViewController(animated: true)
}
Run Code Online (Sandbox Code Playgroud)
它工作得很好,但按下表格视图单元格时我不需要延迟。一旦演示结束,popViewController就会按要求工作,不需要执行延迟。
还有其他方法可以实现这一点吗?或者以某种方式在过渡准备好时收到通知,以便我可以在之后弹出?
我在我的iPhone-App中集成了GrabKit,这是一个从社交网络中获取照片的图书馆.现在我有以下情况/问题:
我有一个UITableViewController - AlbumListViewController.然后是一个UITableViewCell - AlbumCellViewController.当你点击其中一个单元格 - 带照片的相册有一个UITableViewController - PhotoListViewController和一个UITableViewCell - PhotoCellViewController.
这里的所有内容都可以直接使用,我可以浏览相册,选择一个,浏览其中的照片,然后当我选择其中一张照片时,我的SetPhotoViewController上有一个PushViewController,它在Fullscreen中显示所选图像.
现在,当我想在SetPhotoViewController中使用导航栏的后退按钮时,崩溃时会显示以下消息:
*** Assertion failure in -[UISectionRowData refreshWithSection:tableView:tableViewRowData:], /SourceCache/UIKit_Sim/UIKit-2372/UITableViewRowData.m:400
2012-10-22 22:49:32.814 Amis[1820:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to allocate data stores for 1073741821 rows in section 1. Consider using fewer rows'
*** First throw call stack:
(0x23de012 0x1b63e7e 0x23dde78 0x15f9f35 0xc8f83b 0xc923c4 0xb56fa2 0xb5692c 0x1690f 0x1cd653f 0x1ce8014 0x1cd87d5 0x2384af5 0x2383f44 0x2383e1b 0x2a9a7e3 0x2a9a668 0xaab65c 0x42fd 0x2b75)
libc++abi.dylib: terminate called throwing an exception
Run Code Online (Sandbox Code Playgroud)
我的两个UITableViewControllers的DataSource和Delegate都设置为File的Owner. …
ios ×8
objective-c ×4
iphone ×3
swift ×2
animation ×1
ios5 ×1
sdk ×1
storyboard ×1
transition ×1
uitableview ×1
uiview ×1