在我的viewcontroller中,我有一个按钮,按下按钮,输入navigationController,我的代码如下:
-(IBAction)ShangHaiButtonPressed:(id)sender{
marketviewcontroller = [[MarketViewController alloc]initWithNibName:@"MarketViewController" bundle:nil];
NSLog(@"%@",self.navigationController);
[self.navigationController pushViewController:marketviewcontroller animated:YES];
[marketviewcontroller release];
}
Run Code Online (Sandbox Code Playgroud)
但我可以看到self.navigationController为null,如何解决这个问题?谢谢.
更新:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_switchviewcontroller = [[SwitchViewController alloc]initWithNibName:@"SwitchViewController" bundle:nil];
[self.window addSubview:_switchviewcontroller.view];
[self.window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud) 我想调用一个新的视图控制器并从导航控制器堆栈中删除当前的视图控制器.例如.我在控制器A中,我打电话给B.
现在我在堆栈A,B中.现在我想调用C(来自B).我希望堆栈是A,C.
谢谢.
uiviewcontroller uinavigationcontroller viewcontroller navigationcontroller ios
我在StoryBoard中添加了一个NavigationController,并将其作为初始的viewController.如何访问appDelegate中的NavigationController.从navigationController按Ctrl键拖动到AppDelegate不会创建插座.
我正在使用导航组件。导航时我不想创建新的片段实例,如果它已经存在于 backstack 中并弹出前面已经存在的片段。
findNavController().navigate(RequestTransferFragmentDirections.actionRequestTransferFragmentToBlankFragment())
Run Code Online (Sandbox Code Playgroud)
寻找解决方案。
谢谢。
navigation android navigationcontroller android-fragments android-studio
我开发了iPad应用程序.我用导航控制器在popover中打开一些屏幕.但我没有在IOS 7中更改导航控制器色调颜色.如何更改此颜色.感谢名单

UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:airportsSearch] autorelease];
navigationController.navigationBar.barTintColor = [UIColor blackColor];
navigationController.navigationBar.translucent = NO;
self.popOver=[[UIPopoverController alloc] initWithContentViewController:navigationController];
self.popOver.delegate = self;
[self.popOver setPopoverContentSize:CGSizeMake(285, 370)];
[self.popOver presentPopoverFromRect:tempButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
Run Code Online (Sandbox Code Playgroud) 在我的代码中,我使用presentViewController来调用我的第二个viewcontroller
[self presentViewController:secondController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
当我打电话时我需要显示从左到右的动画(比如在navigationController中)
我不想使用navigationController,但我需要类似于presentViewController中的navigationController的动画......
objective-c uiviewcontroller navigationcontroller ios presentviewcontroller
我可以在QlPreviewController控制器中自定义导航栏的颜色吗?
我试过以下
[[UINavigationBar appearanceWhenContainedIn: [QLPreviewController class], nil] setBarTintColor: [UIColor redColor]];
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
谢谢.
navigationcontroller navigationbar qlpreviewcontroller bartintcolor ios11
当我将新的ViewController推送到导航控制器堆栈时,"后退"按钮是前一个控制器的标题.
如何将后退按钮中的文本更改为"后退"而不是默认的最后控制器名称?
当我使用 navController = Navigation.findNAvController(view) 时,我让它在活动中的标签片段中托管的片段中,应用程序因错误而崩溃:View 没有设置 navController。
这是 nav_graph:
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph"
app:startDestination="@id/mainFragment">
<fragment
android:id="@+id/mainFragment"
android:name="studio.apptick.mouj.view.fragments.MainFragment"
tools:layout="@layout/fragment_main"
android:label="fragment_main" >
<action
android:id="@+id/action_mainFragment_to_playlistActivityFragment"
app:destination="@id/playlistActivityFragment" />
<action
android:id="@+id/action_mainFragment_to_searchActivity"
app:destination="@id/searchActivity" />
</fragment>
<activity
android:id="@+id/searchActivity"
android:name="studio.apptick.mouj.view.activity.SearchActivity"
android:label="activity_search"
tools:layout="@layout/activity_search" />
</navigation>
Run Code Online (Sandbox Code Playgroud)
这是活动中的片段标签:
android:id="@+id/nav_host_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/view_player"
android:name="androidx.navigation.fragment.NavHostFragment"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph">
</fragment>
Run Code Online (Sandbox Code Playgroud) navigation android navigationcontroller android-studio android-navigation-graph
我正在使用导航控制器,我设置为真正的导航栏的prefersLargeTitle属性.一切都很好,但是当我的标题文字变得太大时,它就不适合空间.在这里看起来如何:
有可能以某种方式使标题(当导航栏的prefersLargeTitle属性设置为true)动态调整其字体大小,如果是这样,如何实现?
ios ×4
android ×2
iphone ×2
navigation ×2
swift ×2
appdelegate ×1
bartintcolor ×1
button ×1
ios11 ×1
ios7 ×1
objective-c ×1