我有一个UIViewController类,它有一个触发这个的按钮:
DetailViewController *viewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
Run Code Online (Sandbox Code Playgroud)
推动为什么什么都不做?如果重要,UIViewController就在UITabBarController中.
我有一个应用程序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
我有FavouriteViewController一个单击按钮的按钮我正在呈现一个模态调用的视图LoginViewController(使用故事板)
在这个页面(LoginViewController),我再次有按钮,点击我想推我的视图控制器.
可能吗 ?
我有一个FirstViewController用TabBarController与NavigationController
(TabBarController> NavigationController>的UIViewController)
当按下UIButton时firstViewController,它会推到SecondViewController.
SecondViewController *vc2 = [self.storyboard instantiateViewControllerWithIdentifier:@"BVC"];
vc2.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:vc2 animated:YES];
Run Code Online (Sandbox Code Playgroud)
在SecondViewController有一个UILabel上有约束的右下角- (宽度相等,高度相等,TrailingSpaceToSuperView = 16,BottomSpaceToBottomLayoutGuide = 20)
结果在iphone4s(IOS7)上运行正常,但在iphone6(IOS8.1)上,UILabel它将首先出现在右下角加上"BottomBar height"大约1秒,然后将更新到正确的位置(BottomSpaceToBottomLayoutGuide = 20)
当我将pushViewController动画设置为NO时,UILabel会立即显示在正确的位置.
[self.navigationController pushViewController:vc2 animated:NO];
Run Code Online (Sandbox Code Playgroud)
有人遇到同样的问题吗?
我们开始使用Xcode 8.3处理我们的项目,直到iOS 10都很好但是当我们在iOS 11中运行相同的应用程序时,后退按钮没有按预期对齐,如下图所示
但是对于iOS 10,它已经正确对齐
这就是我们得到的布局约束错误
(
"<NSLayoutConstraint:0x600000288200 _UIModernBarButton:0x7f7ef5c87f10.bottom == UILayoutGuide:0x6000005a0380'UIViewLayoutMarginsGuide'.bottom + 64.5 (active)>",
"<NSLayoutConstraint:0x600000287f30 V:[_UIModernBarButton:0x7f7ef5c87f10]-(>=0)-| (active, names: '|':_UIButtonBarButton:0x7f7ef5c86e60 )>",
"<NSLayoutConstraint:0x600000282030 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x6000005a0380'UIViewLayoutMarginsGuide']-(16)-| (active, names: '|':_UIButtonBarButton:0x7f7ef5c86e60 )>"
Run Code Online (Sandbox Code Playgroud)
)
我在导航控制器中有一个表视图,以便我可以将详细视图控制器推送到堆栈上。它工作正常,直到我向导航项添加搜索控制器,如下所示:
searchController = UISearchController(searchResultsController: nil)
searchController.obscuresBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchBar.delegate = self
searchController.searchBar.tintColor = Colors.mlLabel
navigationItem.searchController = searchController
definesPresentationContext = true
Run Code Online (Sandbox Code Playgroud)
它导致临时灰色背景,见下文:
在调试视图层次结构时,看起来UIViewControllerWrapperView's _UIParallaxDimmingView(在下面选择)是导致这种情况的原因,因为导航栏和状态栏都是透明的。
我怎样才能解决这个问题?
注意:将animated属性设置pushViewController()为false有效,但我想保留动画。
更新:这似乎只在 iOS 13 上有问题。甚至可能来自最近的某个版本,因为我之前没有这个问题。
更新 2:我现在在我的应用程序中的多个地方都注意到了同样的问题,而且它不仅仅是与SearchController. 基本上_UIParallaxDimmingView它的鼻子伸出来。
uinavigationbar uinavigationcontroller pushviewcontroller ios uisearchcontroller
我在使用UINavigationController的iPhone应用程序时遇到问题.当我使用pushNavigationController时,它工作正常.iPhone切换到下一个ViewController时会动画.但是当使用ViewControllers数组和setViewControllers方法时,它在动画中有一个小故障,它可以变成一个清晰可见的动画bug.
在根ViewController中调用以下代码段.根据条件,它应该切换到ViewController1,或者它应该直接转到ViewController2.在后一种情况下,用户可以导航回vc1,然后导航到根.
NSMutableArray* viewControllers = [NSMutableArray arrayWithCapacity:2];
// put us on the stack
[viewControllers addObject:self];
// add first VC
AuthentificationViewController* authentificationViewController =
[[[AuthentificationViewController alloc] initWithNibName:@"AuthentificationViewController" bundle:nil] autorelease];
[viewControllers addObject:authentificationViewController];
if (someCondition == YES)
{
UserAssignmentsListViewController* userAssignmentsListViewController =
[[[UserAssignmentsListViewController alloc] initWithNibName:@"UserAssignmentsOverviewViewController" bundle:nil] autorelease];
[viewControllers addObject:userAssignmentsListViewController];
}
[self.navigationController
setViewControllers:[NSArray arrayWithArray:viewControllers] animated:YES];
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我将第一个也许是第二个VC添加到数组中,最后使用动画设置navigationController堆栈.如果我只添加第一个控制器,这可以正常工作.但是在动画应该转到第二个控制器的情况下,导航栏的标题将不会"飞入".相反,在动画结束之前会有一个空标题.而且,更糟糕的是,如果我用自定义按钮替换导航栏标题,此按钮将显示在左上角,直到动画完成.那是一个很明显的错误.
我尝试使用多个pushViewController方法的解决方法,但动画看起来/感觉不对.我希望导航以与pushViewController相同的方式进行动画制作.这里唯一的区别是,我不添加VC,而是立即设置整个堆栈.这里有另一种解决方法,还是可以将其视为框架的错误?我想只使用pushNavController for VC2,然后以某种方式将VC1插入堆栈,但这似乎不可能.
感谢您的所有提示和建议.:-)
技术数据:我使用的是iOS 4.2,编译为4.0.
我的故事板中有一个导航控制器,但由于一个原因,我必须以编程方式制作一个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
我的应用程序设置为标签栏控制器作为RootViewController,并且每个标签都有一个NavigationController.当执行某些操作时,我希望应用程序将其推入ViewController屏幕.这个流程是当应用程序启动或从后台打开时,它会检查存储的NSDate并将其与当前日期进行比较.如果满足正确的条件,则显示a UIAlertView.如果选择了名为"Push"的按钮,它将运行代码以推送新视图.这就是我需要从中运行的原因AppDelegate,因为如果在后台使用该应用程序,则无法保证可以打开哪个选项卡.由于每个选项卡包含一个NavigationController,我想我可以从AppDelegate运行它:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == 100) {
if (buttonIndex == 0) {
//Cancel
NSLog(@"Cancel");
}
if (buttonIndex == 1) {
NSLog(@"OK");
[self.tabBarController.selectedViewController pushViewController:self.newView animated:YES];
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到一条警告信息UIViewController may not respond to -pushViewController:animated.关于我还能做什么的任何建议?
uitabbarcontroller uinavigationcontroller pushviewcontroller ios appdelegate
我想检查导航堆栈中是否存在视图控制器。如果存在,我需要弹出它,否则我需要将其推送到导航堆栈。我已经尝试过以下代码。如果它不存在,控制权将转移到 else 块,但我无法导航到屏幕。请帮我
for aViewController in viewControllers! {
if aViewController is TabProfileViewController {
self.navigationController?.popToViewController(aViewController, animated: true)
}
else {
let lvc = self.storyboard?.instantiateViewController(withIdentifier: "LoginViewController") as? LoginViewController
self.navigationController?.pushViewController(lvc!, animated: true)
}
}
Run Code Online (Sandbox Code Playgroud) ios ×6
iphone ×2
objective-c ×2
animation ×1
appdelegate ×1
autolayout ×1
ios11 ×1
ios6 ×1
ipad ×1
swift ×1
xcode ×1
xcode4.5 ×1